private ContextMenuStrip BuildCategoryMenu(CheckBox RClickedBox) { HM.Entities.HattrickManager.Settings.Category category = user.applicationSettingsField.playerCategoryListField.Find(pc => pc.categoryIdField == Convert.ToUInt16(RClickedBox.Tag)); ContextMenuStrip menu = new ContextMenuStrip(); menu.ShowImageMargin = false; menu.DropShadowEnabled = true; menu.Font = new Font("Calibri", 9, FontStyle.Regular); menu.Tag = RClickedBox.Tag; ToolStripMenuItem colours = new ToolStripMenuItem("Colour"); colours.DropDownItems.AddRange(HM.Resources.GenericFunctions.GetCategoryImageList(category.categoryColourField)); foreach (ToolStripMenuItem item in colours.DropDownItems) { item.Click += new EventHandler(ChangeCategoryColour); } menu.Items.AddRange(new ToolStripItem[] { new ToolStripMenuItem("New Category", null, AddNewCategory_Click), new ToolStripMenuItem("Delete Category", null, DeleteCategory_Click), new ToolStripMenuItem("Rename Category", null, RenameCategory), new ToolStripSeparator(), colours, new ToolStripSeparator(), new ToolStripMenuItem("Clear Category", null, ClearCategory_Click) }); return(menu); }
private void ChangeCategoryColour(uint categoryID, int colourID) { HM.Entities.HattrickManager.Settings.Category category = user.applicationSettingsField.playerCategoryListField.Find(pc => pc.categoryIdField == categoryID); category.categoryColourField = colourID; PopulateCategoryList(); PopulatePlayerList(); }
private void DeleteCategory(uint categoryID) { if (MessageBox.Show("Really delete?", "Confirm delete", MessageBoxButtons.YesNo) == DialogResult.Yes) { HM.Entities.HattrickManager.Settings.Category category = user.applicationSettingsField.playerCategoryListField.Find(pc => pc.categoryIdField == categoryID); user.applicationSettingsField.playerCategoryListField.Remove(category); PopulateCategoryList(); } }
private void RenameCategory(uint categoryID) { HM.Entities.HattrickManager.Settings.Category category = user.applicationSettingsField.playerCategoryListField.Find(pc => pc.categoryIdField == categoryID); string promptValue = HM.Resources.CustomClasses.TextPrompt.ShowDialog("Category Name", category.categoryNameField, "Rename Category"); if (promptValue != string.Empty) { category.categoryNameField = promptValue; PopulateCategoryList(); } }
private List <HMEntities.Settings.Category> ParseSettingCategoryListNode(XmlNode node) { try { List <HMEntities.Settings.Category> categories = new List <HMEntities.Settings.Category>(); foreach (XmlNode xmlCategoryListNodes in node.ChildNodes) { if (xmlCategoryListNodes.NodeType != XmlNodeType.Comment && xmlCategoryListNodes.ChildNodes != null) { HMEntities.Settings.Category category = new HMEntities.Settings.Category(); category.categoryIdField = Convert.ToUInt16(xmlCategoryListNodes.Attributes[Tags.CategoryID].InnerText); foreach (XmlNode xmlCategoryNode in xmlCategoryListNodes.ChildNodes) { switch (xmlCategoryNode.Name) { case Tags.CategoryName: category.categoryNameField = xmlCategoryNode.InnerText; break; case Tags.CategoryColour: category.categoryColourField = Convert.ToInt32(xmlCategoryNode.InnerText); break; case Tags.CategoryChecked: category.categoryCheckedField = Convert.ToBoolean(xmlCategoryNode.InnerText); break; case Tags.CategoryProtected: category.categoryProtectedField = Convert.ToBoolean(xmlCategoryNode.InnerText); break; } } categories.Add(category); } } return(categories); } catch (Exception ex) { throw ex; } }
private void SaveCategoryCheckChange(uint categoryID, bool itemChecked, TableLayoutPanel panel) { HM.Entities.HattrickManager.Settings.Category category = user.applicationSettingsField.playerCategoryListField.Find(pc => pc.categoryIdField == categoryID); category.categoryCheckedField = itemChecked; if (category.categoryNameField == "All") { for (int i = 1; i < panel.Controls.Count; i++) { CheckBox box = (CheckBox)panel.Controls[i]; if (itemChecked) { box.Checked = true; } else { box.Checked = false; } } } else { if (!itemChecked) { CheckBox all = (CheckBox)panel.Controls[0]; if (all.Checked) { all.CheckedChanged -= SaveCategoryChecked; all.Checked = false; all.CheckedChanged += new EventHandler(SaveCategoryChecked); } } } }
private List<HMEntities.Settings.Category> ParseSettingCategoryListNode(XmlNode node) { try { List<HMEntities.Settings.Category> categories = new List<HMEntities.Settings.Category>(); foreach (XmlNode xmlCategoryListNodes in node.ChildNodes) { if (xmlCategoryListNodes.NodeType != XmlNodeType.Comment && xmlCategoryListNodes.ChildNodes != null) { HMEntities.Settings.Category category = new HMEntities.Settings.Category(); category.categoryIdField = Convert.ToUInt16(xmlCategoryListNodes.Attributes[Tags.CategoryID].InnerText); foreach (XmlNode xmlCategoryNode in xmlCategoryListNodes.ChildNodes) { switch (xmlCategoryNode.Name) { case Tags.CategoryName: category.categoryNameField = xmlCategoryNode.InnerText; break; case Tags.CategoryColour: category.categoryColourField = Convert.ToInt32(xmlCategoryNode.InnerText); break; case Tags.CategoryChecked: category.categoryCheckedField = Convert.ToBoolean(xmlCategoryNode.InnerText); break; case Tags.CategoryProtected: category.categoryProtectedField = Convert.ToBoolean(xmlCategoryNode.InnerText); break; } } categories.Add(category); } } return (categories); } catch (Exception ex) { throw ex; } }