private void button_init_Click(object sender, EventArgs e) { enable = false; string s_q = textBox_q.Text; string s_b = textBox_b.Text; string s_a1 = textBox_a1.Text; string s_a2 = textBox_a2.Text; string s_T = textBox_T.Text; string s_x0 = textBox_x0.Text, s_x1 = textBox_x1.Text, s_x2 = textBox_x2.Text; if (!Processing.checkString(s_q, s_b, s_a1, s_a2, s_T, s_x0, s_x1, s_x2)) { MessageBox.Show(" The fields are empty."); } else { try { Processing.q = Int32.Parse(s_q); Processing.a1 = double.Parse(s_a1); Processing.a2 = double.Parse(s_a2); Processing.b = double.Parse(s_b); Processing.T = double.Parse(s_T); Processing.x_0.M[0][0] = double.Parse(s_x0); Processing.x_0.M[1][0] = double.Parse(s_x1); Processing.x_0.M[2][0] = double.Parse(s_x2); Program.k = (int)(30 / Processing.T); if (!Processing.checkComponents(Processing.q, Processing.a1, Processing.a2, Processing.T)) { MessageBox.Show(" Incorrect parametres. Please, try to input again."); } else { Processing.function(); if (!Processing.checkLimit) { MessageBox.Show(" Limit doesn't exist . Please, Enter correct T."); } enable = true; } button1.Enabled = enable; button_output.Enabled = enable; } catch (Exception ex) { enable = false; MessageBox.Show(ex.Message); button1.Enabled = enable; button_output.Enabled = enable; } } }
private void button_init_Click(object sender, EventArgs e) { enable = false; buildControl = true; string s_q = textBox_q.Text; string s_b = textBox_b.Text; string s_a1 = textBox_a1.Text; string s_a2 = textBox_a2.Text; string s_T = textBox_T.Text; string s_x0 = textBox_x0.Text, s_x1 = textBox_x1.Text, s_x2 = textBox_x2.Text; string s_xx0 = textBox_xx0.Text, s_xx1 = textBox_xx1.Text, s_xx2 = textBox_xx2.Text; string s_k0 = textBox_k0.Text; if (!Processing.checkString(s_q, s_b, s_a1, s_a2, s_T, s_x0, s_x1, s_x2)) { MessageBox.Show(" The fields are empty."); } else { try{ Processing.q = Int32.Parse(s_q); Processing.a1 = double.Parse(s_a1); Processing.a2 = double.Parse(s_a2); Processing.b = double.Parse(s_b); Processing.T = double.Parse(s_T); Processing.x_0.M[0][0] = double.Parse(s_x0); Processing.x_0.M[1][0] = double.Parse(s_x1); Processing.x_0.M[2][0] = double.Parse(s_x2); Processing.xx.M[0][0] = double.Parse(s_xx0); Processing.xx.M[1][0] = double.Parse(s_xx1); Processing.xx.M[2][0] = double.Parse(s_xx2); Processing.k0 = Int32.Parse(s_k0); if (Processing.k0 <= 0) { throw new WarningException(" Incorrect parametr k0"); } if (!(Processing.checkComponents(Processing.q, Processing.a1, Processing.a2, Processing.T) && Processing.checkAccurancy(Processing.q))) { MessageBox.Show(" Incorrect parametres. Please, try to input again."); } else { Processing.function(); if (!Processing.checkLimit) { MessageBox.Show(" Limit doesn't exist . Please, Enter correct T."); } // else enable = true; } button1.Enabled = enable; button_output.Enabled = enable; button_control.Enabled = enable; button_outMatrix.Enabled = enable; } catch (Exception ex) { enable = false; MessageBox.Show(ex.Message); button1.Enabled = enable; button_output.Enabled = enable; button_control.Enabled = enable; button_outMatrix.Enabled = enable; } } }