Exemplo n.º 1
0
        private void RebuildDS()
        {
            var old = dataGridView1.DataSource as AxelData ?? new AxelData();
            var ad  = new AxelData();

            label1.Text = "y";
            for (int i = 0; i < numericUpDown1.Value; i++)
            {
                var key = label1.Text;
                HaveParameter(ad, key, old, i == 0 ? 1 : 0);
                label1.Text += "'";
            }

            label1.Text += "=";

            HaveParameter(ad, "Xmin", old, 0);
            HaveParameter(ad, "Xmax", old, 10);
            HaveParameter(ad, "Шагов", old, 1000);
            HaveParameter(ad, "Ymin", old, -10000);
            HaveParameter(ad, "Ymax", old, 10000);

            ad.Order                 = (int)numericUpDown1.Value;
            ad.Expression            = textBox1.Text;
            dataGridView1.DataSource = ad;
        }
Exemplo n.º 2
0
 private static void HaveParameter(AxelData ad, string key, AxelData old, double def = 0)
 {
     ad.Add(new AxelRow()
     {
         Key   = key,
         Value = old.Where(k => k.Key == key).Select(k => (double?)k.Value).FirstOrDefault() ?? def
     });
 }