private void loadToolStripMenuItem_Click(object sender, EventArgs e) { this.colorSchemeToolStripMenuItem.Owner.Hide(); OpenFileDialog dial = WindowColors.LoadColorDialogWithoutShow(); if (dial.ShowDialog() == DialogResult.OK) { WindowColors.LastLoaded(dial.FileName); WindowColors.SetColorsFromXml(dial.FileName); } }
public void UpdateLoadToolStripMenuItems() { #region Set-up for the color load and save if (this.loadToolStripMenuItem.HasDropDownItems) { for (int i = this.loadToolStripMenuItem.DropDownItems.Count; i > 0; i--) { this.loadToolStripMenuItem.DropDownItems.RemoveAt(0); } } Dictionary <string, string> paths = new Dictionary <string, string>(); List <string> names = new List <string>(); List <string> locations = new List <string>(); if (System.IO.Directory.Exists(WindowColors.ColorSettingsFolderPath)) { foreach (String file in System.IO.Directory.GetFiles(WindowColors.ColorSettingsFolderPath)) { if (!file.Contains("ColorScheme.fxcol") && Path.GetExtension(file) == ".fxcol") { paths.Add(System.IO.Path.GetFileNameWithoutExtension(file), file); names.Add(System.IO.Path.GetFileName(file)); locations.Add(file); } } paths.OrderBy((x) => x.Key); foreach (KeyValuePair <string, string> path in paths) { ToolStripMenuItem tool = new ToolStripMenuItem();//new ToolStripButton(); tool.Name = path.Key; tool.Size = new System.Drawing.Size(152, 22); tool.Text = path.Key; if (path.Value == WindowColors.LastColor && !WindowColors.LastColor.Contains("ColorScheme.fxcol")) { ((ToolStripMenuItem)tool).Checked = true; } tool.Click += (a, b) => WindowColors.SetColorsFromXml(WindowColors.ColorSettingsFolderPath + "\\" + tool.Name + ".fxcol"); this.loadToolStripMenuItem.DropDownItems.Add(tool); } } #endregion }