} // End Constructor /*Create Button*/ private async void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args) { ComboBoxItem selected = (ComboBoxItem)Hub.SelectedValue; try { AirCoon.Game.Handler.SaveGame sg = new AirCoon.Game.Handler.SaveGame(selected.Tag.ToString(), Code.Text, Name.Text ); } catch (SaveGameException e) { DialogNewGame dialog = new DialogNewGame(Name.Text, Code.Text, selected.Tag.ToString(), e.Message ); this.Hide(); await dialog.ShowAsync(); } }
public DialogNewGame() { AirCoon.Game.Handler.SaveGame sg = new AirCoon.Game.Handler.SaveGame(); List <Dictionary <string, string> > aps = sg.GetAvailibleHubNames(); this.InitializeComponent(); foreach (Dictionary <string, string> ap in aps) { ComboBoxItem b = new ComboBoxItem(); b.Tag = ap["Iata"]; b.Content = ap["Iata"] + " - " + ap["Name"]; if (ap["Iata"] == "ATL") { b.IsSelected = true; } Hub.Items.Add(b); } // End Foreach } // End Constructor
} // End Constructor public DialogNewGame(String name, String code, String Iata, String message) { AirCoon.Game.Handler.SaveGame sg = new AirCoon.Game.Handler.SaveGame(); List <Dictionary <string, string> > aps = sg.GetAvailibleHubNames(); this.InitializeComponent(); Name.Text = name; Code.Text = code; Error.Text = message; foreach (Dictionary <string, string> ap in aps) { ComboBoxItem b = new ComboBoxItem(); b.Tag = ap["Iata"]; b.Content = ap["Iata"] + " - " + ap["Name"]; if (ap["Iata"] == Iata) { b.IsSelected = true; } Hub.Items.Add(b); } // End Foreach } // End Constructor