private void VSFrmXML_Load(object sender, EventArgs e) { string ks = VSLib.VSGetKey(DEFS.KEY_STORAGE_ROOT); if (ks != "") { if (MessageBox.Show(ks, "Do you want to open the last used storage?", MessageBoxButtons.YesNo) == DialogResult.Yes) { ACTION_OpenStorage(ks); } } this.SHOW_Buttons(); }
private void VSFrmAdm_Load(object sender, EventArgs e) { mgr = null; string ks = VSLib.VSGetKey(DEFS.KEY_STORAGE_ROOT); if (ks != "") { if (MessageBox.Show(ks, "Do you want to open the last used storage?", MessageBoxButtons.YesNo) == DialogResult.Yes) { OpenRoot(ks); } } ShowButtons(); }
/// <summary> /// Get path /// </summary> /// <param name="key"></param> /// <param name="title"></param> /// <returns></returns> public static string SelectPath(string key, string title) { FolderBrowserDialog d = new FolderBrowserDialog(); d.SelectedPath = VSLib.VSGetKey(key); d.Description = title + ((d.SelectedPath == "") ? "" : " (default: '" + d.SelectedPath + "')"); DialogResult result = d.ShowDialog(); if ((result != DialogResult.Cancel) & (d.SelectedPath != "")) { VSLib.VSSetKey(key, d.SelectedPath); return(d.SelectedPath); } else { return(""); } }
/// <summary> /// Get file /// </summary> /// <param name="key"></param> /// <param name="title"></param> /// <returns></returns> public static string SelectFile(string key, string title, string filter) { OpenFileDialog d = new OpenFileDialog(); d.Filter = filter; d.Title = "Select file"; d.InitialDirectory = VSLib.VSGetKey(key); DialogResult result = d.ShowDialog(); if ((result != DialogResult.Cancel) & (d.FileName != "")) { //File.WriteAllText(key, Path.GetDirectoryName(d.FileName)); VSLib.VSSetKey(key, Path.GetDirectoryName(d.FileName)); return(d.FileName); } else { return(""); } }