/// <summary> /// Happens when the game selection combo box selection changes. Sets the current lotto to the new Lotto object /// based on the value got from the selection. /// </summary> /// <param name="sender">The combo boc element which fired the event.</param> /// <param name="e"></param> private void cmbbxChooseGame_SelectionChanged(object sender, SelectionChangedEventArgs e) { ComboBoxItem item = (ComboBoxItem)((ComboBox)sender).SelectedItem; string value = item.Content.ToString().ToLower().Replace(" ", ""); this.ClearResult(); if (value == "suomi") { this.currentLotto = new Lotto("suomi", 37, 7); } else if(value == "vikinglotto") { this.currentLotto = new Lotto("vikinglotto", 48, 6); } else if (value == "eurojackpot") { this.currentLotto = new Lotto("eurojackpot", 50, 7); } }
public MainWindow() { InitializeComponent(); this.currentLotto = new Lotto("suomi", 39, 7); this.cmbbxChooseGame.Text = "Suomi"; }