Exemplo n.º 1
0
 private void RectangleCalculateButton2_Click(object sender, RoutedEventArgs e)
 {
     if (Judge.IsNumber(Point1XTextbox.Text) && Judge.IsNumber(Point1YTextbox.Text) && Judge.IsNumber(Point2XTextbox.Text) && Judge.IsNumber(Point2YTextbox.Text) && Judge.IsNumber(Point3XTextbox.Text) && Judge.IsNumber(Point3YTextbox.Text))
     {
         TriangleCalculate MyTriangleCalculate = new TriangleCalculate();
         TriangleAreaTextbox2.Text = MyTriangleCalculate.CalculateArea(unit2, Point1XTextbox.Text, Point1YTextbox.Text, Point2XTextbox.Text, Point2YTextbox.Text, Point3XTextbox.Text, Point3YTextbox.Text);
     }
     else
     {
         Warning.Sound();
         MessageBox.Show("The things you input must be numbers!");
     }
 }
Exemplo n.º 2
0
 private void RectangleCalculateButton_Click(object sender, RoutedEventArgs e)
 {
     if (Judge.IsNumber(Side1Textbox.Text) && Judge.IsNumber(Side2Textbox.Text) && Judge.IsNumber(Side3Textbox.Text))
     {
         double data1 = Convert.ToDouble(Side1Textbox.Text);
         double data2 = Convert.ToDouble(Side2Textbox.Text);
         double data3 = Convert.ToDouble(Side3Textbox.Text);
         if ((data1 + data2 > data3) && (data1 + data3 > data2) && (data2 + data3 > data1))
         {
             TriangleCalculate MyTriangleCalculate = new TriangleCalculate();
             TriangleAreaTextbox.Text = MyTriangleCalculate.CalculateArea(unit, data1, data2, data3);
         }
         else
         {
             Warning.Sound();
             MessageBox.Show("This is not a triangle!");
         }
     }
     else
     {
         Warning.Sound();
         MessageBox.Show("The things you input must be numbers!");
     }
 }