Example #1
0
        //Решение R1
        private void R1()
        {
            int f;

            if (Int32.TryParse(R1CountBox.Text, out f) && ((Int32.TryParse(R1StartBox.Text, out f) && f > 0) || R1Check.Checked))
            {
                R1Box.Items.Clear();
                chartR1.Series["Числа"].Points.Clear();
                chartR1.Series["График"].Points.Clear();
                double x;
                if (R1Check.Checked)
                {
                    x = DateTime.Now.Millisecond;
                    R1StartBox.Text = Convert.ToString(x);
                }
                else
                {
                    x = Convert.ToInt32(R1StartBox.Text);
                }
                int n = Convert.ToInt32(R1CountBox.Text);
                if (n > 0 && x > 0)
                {
                    R1 r1 = new R1();
                    r1.SolveR1(n, (int)x);

                    for (int i = 0; i < r1.list.Count; i++)
                    {
                        R1Box.Items.Add(r1.list[i]);
                    }
                    foreach (var i in r1.Dic)
                    {
                        chartR1.Series["График"].Points.AddXY(i.Key, i.Value);
                        chartR1.Series["Числа"].Points.AddXY(i.Key, i.Value);
                    }
                }
            }
        }