private void Delete() { TreeNode SelNode = TreeView_ShopMenu2.SelectedNode; if (SelNode.Parent != null) { if (SelNode.Parent.Text == "Shop Types") { var SelShop = new ShopMenu2.Shop(); foreach (var shop in menuData.shops) { if (SelNode.Text == shop.Name) { SelShop = shop; break; } } if (menuData.shops.Contains(SelShop)) { menuData.shops.Remove(SelShop); TreeView_ShopMenu2.Nodes.Remove(SelNode); Text = Language.GetString("$SHOPMENU2_EDITOR_TITLE") + "*"; bIsFileEdited = true; } } else if (SelNode.Parent.Text == "Shop MetaInfo") { var SelItem = new ShopMenu2.ShopMenu(); foreach (var item in menuData.shopItems) { if (SelNode.Text == item.Path) { SelItem = item; break; } } if (menuData.shopItems.Contains(SelItem)) { menuData.shopItems.Remove(SelItem); TreeView_ShopMenu2.Nodes.Remove(SelNode); Text = Language.GetString("$SHOPMENU2_EDITOR_TITLE") + "*"; bIsFileEdited = true; } } } }
private void AddType() { var shop = new ShopMenu2.Shop(); var child = new TreeNode("Shop" + shop.ID.ToString()); shop.Name = "New Shop " + menuData.shops.Count.ToString(); menuData.shops.Add(shop); var NewShop = menuData.shops[menuData.shops.Count - 1]; child.Text = NewShop.Name; child.Tag = NewShop; TreeView_ShopMenu2.Nodes[0].Nodes.Add(child); Text = Language.GetString("$SHOPMENU2_EDITOR_TITLE") + "*"; bIsFileEdited = true; }