private void btnAddWeapon_Click(object sender, EventArgs e) { ItemSelectionChoice = ItemSelectionChoices.AddWeapon; IEnumerable <ItemContainer> Items = GetItemsByRoot(GUIRootPathTripleThunderWeapons); MenuFilter OutMenu = new MenuFilter(); OutMenu.ListItem = new Dictionary <string, string>(); foreach (ItemContainer ActiveItemContainer in Items) { foreach (KeyValuePair <string, string> ActiveItem in ActiveItemContainer.ListItem) { string Name = FilePath.Substring(29); Name = Name.Substring(0, Name.Length - 4); if (ActiveItem.Key.StartsWith(Name)) { if (ActiveItem.Key.StartsWith(Name + "/Weapons")) { string WeaponName = ActiveItem.Key.Substring(24); OutMenu.ListItem.Add(WeaponName, WeaponName); } else if (ActiveItem.Key.StartsWith(Name + "/Grenades")) { string WeaponName = ActiveItem.Key.Substring(25); OutMenu.ListItem.Add(WeaponName, WeaponName); } } } } ItemSelector ItemSelectorMenu = new ItemSelector(OutMenu, true); ItemSelectorMenu.TopMost = true; ItemSelectorMenu.ShowDialog(); //Item selected, call the ItemsSelected method. if (ItemSelectorMenu.DialogResult == System.Windows.Forms.DialogResult.OK) { ListMenuItemsSelected(ItemSelectorMenu.GetResult()); } }