private void btnGenerate_Click(object sender, EventArgs e) { try { int a = Int32.Parse(textBox1.Text); int m = Int32.Parse(textBox2.Text); double r = Double.Parse(textBox3.Text); IRandomNumberGenerator numberGenerator = null; switch (lstGenerators.SelectedIndex) { case 0: numberGenerator = new LehmerGenerator(a, m, r); break; case 1: numberGenerator = new UniformGenerator(a, m, r, Double.Parse(ArgA.Text), Double.Parse(ArgB.Text)); break; case 2: numberGenerator = new GaussGenerator(a, m, r, Double.Parse(ArgA.Text), Double.Parse(ArgB.Text)); break; case 3: numberGenerator = new ExponentialGenerator(a, m, r, Double.Parse(ArgA.Text)); break; case 4: numberGenerator = new GammaGenerator(a, m, r, Double.Parse(ArgA.Text), Double.Parse(ArgB.Text)); break; case 5: numberGenerator = new TriangleGenerator(a, m, r, Double.Parse(ArgA.Text), Double.Parse(ArgB.Text)); break; case 6: numberGenerator = new SimpsonGenerator(a, m, r, Double.Parse(ArgA.Text), Double.Parse(ArgB.Text)); break; } int period; int aperiodicity; List<double> numbers = new List<double>(numberGenerator.Generate(out period, out aperiodicity)); ExpectedValue.Text = numbers.ExpectedValue().ToString(); Dispersion.Text = numbers.Dispersion().ToString(); StandartDeviation.Text = numbers.StandartDeviation().ToString(); Period.Text = period.ToString(); Aperiodicity.Text = aperiodicity.ToString(); Uniformity.Text = numbers.Uniformity().ToString(); int intervalCount = Int32.Parse(textBox7.Text); if (intervalCount >= 5 && intervalCount <= 25) { UpdateChart(numbers, intervalCount); } else { throw new Exception(); } SaveNumbersToFile(numbers); } catch { MessageBox.Show("Введите корректные исходные данные", "Ошибка"); } }