private void button1_Click(object sender, EventArgs e) { if ((double)numericUpDown1.Value == 0 || (double)numericUpDown2.Value == 0 || (double)numericUpDown3.Value == 0 || (double)numericUpDown4.Value == 0 || (double)numericUpDown5.Value == 0) { errorLabel.Text = "Please make sure that every probability is more than 0"; return; } double sum = (double)numericUpDown1.Value + (double)numericUpDown2.Value + (double)numericUpDown3.Value + (double)numericUpDown4.Value + (double)numericUpDown5.Value; if (sum != 1) { Console.WriteLine($"{sum}"); errorLabel.Text = "Please make sure the sum of probabilities is 1"; return; } generator = new EventsGenerator(new double[] { (double)numericUpDown1.Value, (double)numericUpDown2.Value, (double)numericUpDown3.Value, (double)numericUpDown4.Value, (double)numericUpDown5.Value }, (int)numericUpDown6.Value); frequency = generator.GenerateEvents(); UpdateChart(); UpdateCalculations(); errorLabel.Text = ""; }
private void button1_Click(object sender, EventArgs e) { generator = new EventsGenerator((double)numericUpDown1.Value, (double)numericUpDown2.Value, (int)numericUpDown6.Value); frequency = generator.GenerateEvents(); UpdateChart(); UpdateCalculations(); errorLabel.Text = ""; }