diff --git a/Tilandis.VC.db b/Tilandis.VC.db index 25e17de..3c4c64a 100644 Binary files a/Tilandis.VC.db and b/Tilandis.VC.db differ diff --git a/TilandisGUI/Form1.cs b/TilandisGUI/Form1.cs index 7046f4a..65b5ffe 100644 --- a/TilandisGUI/Form1.cs +++ b/TilandisGUI/Form1.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics; // Process, ProcessStartInfo. using System.Windows.Forms; using System.Runtime.InteropServices; using System.IO; @@ -23,6 +24,8 @@ private void Form1_Load(object sender, EventArgs e) { func_reloadjson(); lst_links.SelectedIndexChanged += clbk_linksel; + + btn_dellink.Click += clbk_dellink; } private void clbk_linksel(object sender, EventArgs e) { @@ -32,7 +35,7 @@ private void clbk_linksel(object sender, EventArgs e) { ListViewItem lvi_curitem = lst_links.SelectedItems[0]; - JObject prop_linksettings = (JObject) json_links.Value(lvi_curitem.Text); + JObject prop_linksettings = json_links.Value(lvi_curitem.Text); edt_linkname.Text = lvi_curitem.Text; edt_pathname.Text = prop_linksettings.Value("path"); @@ -42,6 +45,8 @@ private void clbk_linksel(object sender, EventArgs e) { } private void func_reloadjson() { + lst_links.Items.Clear(); + StreamReader r = new StreamReader("links.json"); string str_linksjson = r.ReadToEnd(); json_links = JObject.Parse(str_linksjson); @@ -56,5 +61,27 @@ private void func_reloadjson() { lst_links.Items.Add(lvi_curitem); } } + + private void clbk_dellink(object sender, EventArgs e) { + if (lst_links.SelectedItems.Count <= 0) { + MessageBox.Show("Select a link first."); + return; + } + + ListViewItem lvi_curitem = lst_links.SelectedItems[0]; + + ProcessStartInfo psi_tilandis = new ProcessStartInfo(); + psi_tilandis.FileName = "tilandis.exe"; + psi_tilandis.Arguments = "-d " + lvi_curitem.Text; + psi_tilandis.UseShellExecute = true; // carry workdir over + + Process proc_tilandis = new Process(); + proc_tilandis.StartInfo = psi_tilandis; + + proc_tilandis.Start(); + proc_tilandis.WaitForExit(); + + func_reloadjson(); + } } } diff --git a/TilandisGUI/TilandisGUI.csproj b/TilandisGUI/TilandisGUI.csproj index 6c0bbdd..557bedc 100644 --- a/TilandisGUI/TilandisGUI.csproj +++ b/TilandisGUI/TilandisGUI.csproj @@ -29,14 +29,15 @@ true - AnyCPU + x64 true full false - bin\Debug\ + ..\x64\Debug\ DEBUG;TRACE prompt 4 + false x64