//Open the AdvancedGametype window and return information. private void AdvancedGametypeWindow(string[] maps, ListBoxItem boxItem) { var w = new MoreGametype(maps, boxItem.Content.ToString()); if (w.ShowDialog() == false) { VotingTypes foo = w.typeStuff; for (int i = 0; i < this.types.Count; i++) { if (this.types[i].displayName == foo.displayName) { this.types[i] = foo; return; } } this.types.Add(foo); } }
public MoreGametype(string[] maps, string typeName) { InitializeComponent(); typeStuff = new VotingTypes(typeName); foreach (KeyValuePair <string, string> kv in Defaults.defaultMaps) { var newItem = new ListBoxItem(); newItem.Content = kv.Key; mapsList.Items.Add(newItem); } foreach (string map in maps) { var newItem = new ListBoxItem(); newItem.Content = map.Split('\\').Last(); mapsList.Items.Add(newItem); } }