Exemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (CircuitType == 0)
            {
                Form_series mainForm = (Form_series)this.Owner;

                this.SetParameters(mainForm);
                if (exitCode)
                {
                    mainForm.Show();
                    this.Close();
                    mainForm.showParameters(VoltCurr);
                }
                else
                {
                    MessageBox.Show("Something went wrong :(");
                }
            }
            if (CircuitType == 1)
            {
                Form_parallel mainForm = (Form_parallel)this.Owner;

                this.SetParameters(mainForm);
                if (exitCode)
                {
                    mainForm.Show();
                    this.Close();
                    mainForm.showParameters(VoltCurr);
                }
                else
                {
                    MessageBox.Show("Something went wrong :(");
                }
            }
        }
Exemplo n.º 2
0
        private void button_parallel_Click(object sender, EventArgs e)
        {
            Parameters    fParam    = new Parameters(1);
            Form_parallel fparallel = new Form_parallel();

            fParam.Owner = fparallel;
            fParam.Show();
            this.Hide();
        }
Exemplo n.º 3
0
 private void параллельноеСоединениеToolStripMenuItem1_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Вы уверены, что хотите закрыть текущую схему?",
                         "Новая схема", MessageBoxButtons.YesNo, MessageBoxIcon.Question,
                         MessageBoxDefaultButton.Button1) == DialogResult.Yes)
     {
         Parameters    fParam    = new Parameters(1);
         Form_parallel fParallel = new Form_parallel();
         fParam.Owner = fParallel;
         fParam.Show();
         this.Close();
     }
 }
Exemplo n.º 4
0
        private void SetParameters(Form_parallel mainForm)
        {
            //Form_series mainForm = (Form_series)this.Owner;
            bool setRes = false;
            bool setInd = false;
            bool setCap = false;
            bool setSum = false;

            double result;

            // Resistor
            if (Double.TryParse(this.textBox_resistance.Text, out result))
            {
                mainForm.circuit.res1.SetResistance(Double.Parse(textBox_resistance.Text));
                //circuit.res1.SetResistance(Double.Parse(textBox_resistance.Text));
                setRes = true;
            }
            else
            {
                MessageBox.Show("Incorrect data! Please enter a number!");
            }

            //Inductor
            if (Double.TryParse(this.textBox_inductance.Text, out result))
            {
                mainForm.circuit.ind1.SetInductance(Double.Parse(textBox_inductance.Text));
                setInd = true;
            }
            else
            {
                MessageBox.Show("Incorrect data! Please enter inductance again!");
            }

            //Capacitor
            if (Double.TryParse(this.textBox_capacity.Text, out result))
            {
                mainForm.circuit.cap1.SetCapacity(Double.Parse(textBox_capacity.Text));
                setCap = true;
            }
            else
            {
                MessageBox.Show("Incorrect data, try to enter capacity again!");
            }

            //Voltage or Current
            if (Double.TryParse(this.textBox_voltSum.Text, out result))
            {
                if (this.listBox_volt_cur.SelectedIndex == 0)
                {
                    mainForm.circuit.setVoltageSum(Double.Parse(textBox_voltSum.Text));
                    setSum   = true;
                    VoltCurr = 0;
                }
                if (this.listBox_volt_cur.SelectedIndex == 1)
                {
                    mainForm.circuit.setCurrentSum(Double.Parse(textBox_voltSum.Text));
                    setSum   = true;
                    VoltCurr = 1;
                }
            }
            else
            {
                MessageBox.Show("Incorrect data, try to enter voltage again!");
            }


            exitCode = setCap & setRes & setInd & setSum;
        }