public Form2(Form1 FormPadre, Start_Creg CregInit)
 {
     this.FormPadre  = FormPadre;
     this.FormFiglio = new Form3();
     this.CregInit   = CregInit;
     InitializeComponent();
 }
        private void butCalcolo_Click(object sender, EventArgs e)
        {
            int IndiceFormato;

            for (int i = 0; i < this.Formati.Length; i++)
            {
                if (Formati[i].GetNome().Equals(comboBoxFormato.SelectedItem))
                {
                    IndiceFormato = i;
                    break;
                }
            }

            Formato FormatoA   = this.Formati[0];
            int     NumeroCreg = ((FormatoA.PpmF - FormatoA.PpmI) / FormatoA.Passo) + 1;

            Creg[] CregTot = new Creg[NumeroCreg];
            for (int i = 0; i < NumeroCreg; i++)
            {
                FormatoA.PpmA = FormatoA.PpmI + (FormatoA.Passo * i);
                CregTot[i]    = new Creg(FormatoA, textBoxPath.Text, 2);
                chartCreg.Series["Creg"].Points.AddXY(FormatoA.PpmA, CregTot[i].CregAttuale);
            }

            int Tolleranza = Convert.ToInt32(textBoxTolleranza.Text);

            this.CregInit          = new Start_Creg(CregTot, Tolleranza, (-1 * Tolleranza));
            textBoxBs.Text         = CregInit.Bs.ToString();
            textBoxBv.Text         = CregInit.Bv.ToString();
            this.butAvanti.Enabled = true;

            //Disegno il grafico
            chartCreg.Series["Creg"].ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
            chartCreg.Series["Creg"].ChartArea = "ChartArea1";

            //Aggiorno FormFiglio
            this.FormFiglio = new Form2(this, this.CregInit);
        }
Beispiel #3
0
        private void butCalcolo_Click(object sender, EventArgs e)
        {
            //Cancello i punti del grafico precedente
            foreach (var series in chartCreg.Series)
            {
                series.Points.Clear();
            }

            //Rendo visibile il grafico
            chartCreg.Visible = true;

            //Ottengo l'indice dell'array del formato selezionato nella combobox
            int IndiceFormato = 0;

            for (int i = 0; i < this.Formati.Length; i++)
            {
                if (Formati[i].GetNome().Equals(comboBoxFormato.SelectedItem))
                {
                    IndiceFormato = i;
                    break;
                }
            }

            //Setto il formato attuale
            Formato FormatoA = this.Formati[IndiceFormato];

            //Calcolo il numero di Creg da calcolare
            int NumeroCreg = ((FormatoA.PpmF - FormatoA.PpmI) / FormatoA.Passo) + 1;

            Creg[] CregTot = new Creg[NumeroCreg];

            //Istanzio i vari Creg e li inizializzo
            for (int i = 0; i < NumeroCreg; i++)
            {
                FormatoA.PpmA = FormatoA.PpmI + (FormatoA.Passo * i);
                CregTot[i]    = new Creg(FormatoA, textBoxPath.Text, Global.NumPeriodi);
                chartCreg.Series["Creg"].Points.AddXY(FormatoA.PpmA, CregTot[i].CregAttuale);
            }

            //Setto la tolleranza
            int Tolleranza = Convert.ToInt32(textBoxTolleranza.Text);

            //Istanzio lo Start_Creg, ovvero la classe che contiene tutti i Creg di inizializzazione
            this.CregInit = new Start_Creg(CregTot, Tolleranza, (-1 * Tolleranza));

            //Visualizzo Bs e Bv
            textBoxBs.Text         = CregInit.Bs.ToString();
            textBoxBv.Text         = CregInit.Bv.ToString();
            this.butAvanti.Enabled = true;

            //Disegno il grafico
            chartCreg.Series["Creg"].ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
            chartCreg.Series["Creg"].ChartArea = "ChartArea1";

            //Aggiorno FormFiglio
            this.FormFiglio = new Form2(this, this.CregInit);

            //Operazioni sulla grafica
            butCalcolo.Enabled        = false;
            comboBoxFormato.BackColor = Color.LightGreen;
            textBoxPath.Text          = "Inserire Path Salvataggio .CSV";
            textBoxTolleranza.Text    = "Inserire un Intero";
            textBoxPath.Enabled       = false;
            textBoxTolleranza.Enabled = false;
        }