void item_Click(object sender, EventArgs e) { var item = (ToolStripItem)sender; var otherWordWrapOptions = new WordWrapOptionsOld(); string path = "WordWrapOptions\\" + item.Tag; RegistryUtility.GetObject(path, otherWordWrapOptions); this.WordWrapOptions.AssignFrom(otherWordWrapOptions); this.bindingSource.ResetBindings(false); }
private static void SavePath(string ainFileName, DialogTopic topic, string path) { if (String.IsNullOrEmpty(ainFileName)) { ainFileName = "Default"; } string regPath = "Directories\\" + ainFileName; string regKey = topic.ToString(); RegistryUtility.SaveSetting(regKey, regPath, path); }
private void ReadFromRegistry() { if (!RegistryUtility.TryGetSetting("RecentFiles", "", out filesList)) { filesList = dummy; } if (filesList == null) { filesList = dummy; } }
public static AnnotationSettings GetAnnotationSettings(AinFile ainFile) { var annotationSettings = new AnnotationSettings(); string baseName = Path.GetFileNameWithoutExtension(ainFile.OriginalFilename); string pathName = "AnnotationSettings\\" + baseName; if (RegistryUtility.PathExists(pathName)) { RegistryUtility.GetObject(pathName, annotationSettings); } else { } return(annotationSettings); }
void newItem_Click(object sender, EventArgs e) { ToolStripItem item = sender as ToolStripItem; if (item != null) { string codeName = item.Tag as string; if (codeName == null) { codeName = item.Text; } RegistryUtility.GetObject("AnnotationSettings\\" + codeName, mySettings); ReadSettings(); } }
private void toolStripDropDownButton1_DropDownOpening(object sender, EventArgs e) { var names = RegistryUtility.ListKeys("WordWrapOptions\\").OrderBy().ToArray(); var toolStripItem = (ToolStripDropDownButton)sender; toolStripItem.DropDownItems.Clear(); var items = names.Select((n) => { var item = new ToolStripMenuItem(n); item.Tag = n; item.Click += new EventHandler(item_Click); return(item); }).ToArray(); toolStripItem.DropDownItems.AddRange(items); }
private void importToolStripButton_DropDownOpening(object sender, EventArgs e) { foreach (ToolStripItem dropDownItem in importToolStripButton.DropDownItems) { dropDownItem.Click -= new EventHandler(newItem_Click); } importToolStripButton.DropDownItems.Clear(); string[] keys = RegistryUtility.ListKeys("AnnotationSettings"); foreach (var key in keys) { var newItem = new ToolStripMenuItem(key); newItem.Tag = key; newItem.Click += new EventHandler(newItem_Click); importToolStripButton.DropDownItems.Add(newItem); } }
private static bool TryGetPath(string ainFileName, DialogTopic topic, ref string path) { if (String.IsNullOrEmpty(path)) { if (String.IsNullOrEmpty(ainFileName)) { ainFileName = "Default"; } string regPath = "Directories\\" + ainFileName; string regKey = topic.ToString(); path = RegistryUtility.GetSetting(regKey, regPath, "") ?? ""; if (String.IsNullOrEmpty(path)) { return(false); } return(true); } return(false); }
public void SaveToRegistry(string registryPathName) { RegistryUtility.SaveObject(registryPathName, this); }
private void SaveToRegistry() { RegistryUtility.SaveSetting("RecentFiles", "", filesList); }