public MainWindow() { InitializeComponent(); comboBox.Text = BLLotto.GameName(comboBox.SelectedIndex); comboBox.Items.Add(BLLotto.GameName(0)); comboBox.Items.Add(BLLotto.GameName(1)); comboBox.Items.Add(BLLotto.GameName(2)); DrawTextBox.Text = "1"; comboBox.SelectedIndex = 0; DrawsTextBox.Text = ""; }
private void Drawbtn_Click(object sender, RoutedEventArgs e) { int draws = Convert.ToInt32(DrawTextBox.Text); for (int i = 0; i < draws; i++) { int[] luvut = BLLotto.DrawNumber(comboBox.SelectedIndex); DrawsTextBox.Text = DrawsTextBox.Text + BLLotto.GameName(comboBox.SelectedIndex) + ":"; int test = 0; foreach (int luku in luvut) { if (DrawsTextBox.Text == "" || test == 0) { DrawsTextBox.Text = DrawsTextBox.Text + " " + luku.ToString(); } else { DrawsTextBox.Text = DrawsTextBox.Text + ", " + luku.ToString(); } test++; } DrawsTextBox.Text = DrawsTextBox.Text + ".\n"; } }
private void comboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { comboBox.Text = BLLotto.GameName(comboBox.SelectedIndex); }