//method to hide buttons, graphs etc. private void hide() { Mdgv.Hide(); ForecastMlbl.Hide(); numericUpDown1.Hide(); numericUpDown2.Hide(); ForecastRun.Hide(); ForecastP1.Hide(); label1.Hide(); label2.Hide(); ForecastP2.Hide(); ForecastP3.Hide(); }
//this method helps setup the numeric counters private void Mdgv_CellClick(object sender, DataGridViewCellEventArgs e) { System.Windows.Forms.Cursor old = this.Cursor; this.Cursor = Cursors.AppStarting; ForecastP1.Hide(); ForecastP2.Hide(); ForecastP3.Hide(); numericUpDown1.Show(); numericUpDown2.Show(); ForecastRun.Show(); label1.Show(); label2.Show(); //depending on the model that the user chooses, setup the Data list object which will be used elsewhere //the numeric counters will be based off of the Data list int mposition = 0; mposition = Mdgv.SelectedRows[0].Index; int nd = Modellist[mposition].D; bool subtmean = false; subtmean = Modellist[mposition].Subtractmean; this.Data.Clear(); if (nd > 0) { P.DifferencedData.Clear(); this.P.Diff = nd; P.difference(); foreach (double dd in P.DifferencedData) { this.Data.Add(dd); } } else { List <double> tempdata = new List <double>(); if (subtmean == true) { double aver = P.avg(P.D); foreach (double dd in P.D) { tempdata.Add(dd - P.avg(P.D)); } } else { foreach (double dd in P.D) { tempdata.Add(dd); } } foreach (double dd in tempdata) { this.Data.Add(dd); } } //now setup the numeric objects int count = Data.Count(); numericUpDown1.Value = 1; numericUpDown1.Minimum = 1; numericUpDown1.Maximum = 200; numericUpDown1.Increment = 1; int nar = 0; int nma = 0; int narchp = 0; int narchq = 0; nar = Modellist[mposition].P; nma = Modellist[mposition].Q; narchp = Modellist[mposition].archP; narchq = Modellist[mposition].archQ; int inc = (int)Math.Floor((double)this.Data.Count() / 500.0); List <double> lst = new List <double> { (double)nar, (double)nma, (double)narchp, (double)narchq }; numericUpDown2.Minimum = (int)P.maximum(lst) + 2; numericUpDown2.Maximum = Data.Count(); numericUpDown2.Value = Data.Count(); numericUpDown2.Increment = inc; this.Cursor = old; }