Esempio n. 1
0
 private void MultsTocombo_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (SelMultsFrom == "")
     {
     }
     else
     {
         if (Isstarted && !MultsFromcombo.Items.IsEmpty)
         {
             try
             {
                 Calculations.Calculate calculate = new Calculations.Calculate();
                 SelMultsTo = MultsTocombo.SelectedItem.ToString().Remove(0, 38);
                 Input      = Convbox1.Text;
                 double re = double.Parse(calculate.Calculator(Input, "Degree"));
                 if (SelectedOp == "Volume" || SelectedOp == "Speed" || SelectedOp == "Area")
                 {
                     ConvMults(re, "");
                 }
                 else
                 {
                     ConvMults(re, "To");
                 }
                 Convbox2.Text = Result;
             }
             catch (Exception ex)
             {
                 MessageBox.Show("Unexpected Error: " + ex.Message + "\nPlease Try again", "Calculation-Error");
             }
         }
     }
 }
Esempio n. 2
0
 private void ToCombo_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (SelectedFrom == "")
     {
     }
     else
     {
         if (Isstarted && !ToCombo.Items.IsEmpty)
         {
             try
             {
                 Calculations.Calculate calculate = new Calculations.Calculate();
                 SelectedTo = ToCombo.SelectedItem.ToString().Remove(0, 38);
                 Input      = Convbox1.Text;
                 double re = double.Parse(calculate.Calculator(Input, "Degree"));
                 Convert(re);
                 Convbox2.Text = Result;
             }
             catch (Exception ex)
             {
                 MessageBox.Show("Unexpected Error: " + ex.Message + "\nPlease Try again", "Calculation-Error");
             }
         }
     }
 }
Esempio n. 3
0
 private void Convbox1_TextChanged(object sender, TextChangedEventArgs e)
 {
     if (Unitsradio.IsChecked == true)
     {
         if (SelectedFrom == "" || SelectedTo == "")
         {
         }
         else
         {
             try
             {
                 Calculations.Calculate calculate = new Calculations.Calculate();
                 Input = Convbox1.Text;
                 double re = double.Parse(calculate.Calculator(Input, "Degree"));
                 Convert(re);
                 Convbox2.Text = Result;
             }
             catch (Exception)
             {
             }
         }
     }
     else if (Multsradio.IsChecked == true)
     {
         try
         {
             Calculations.Calculate calculate = new Calculations.Calculate();
             SelMultsTo = MultsTocombo.SelectedItem.ToString().Remove(0, 38);
             Input      = Convbox1.Text;
             double re = double.Parse(calculate.Calculator(Input, "Degree"));
             if (SelectedOp == "Volume" || SelectedOp == "Speed" || SelectedOp == "Area")
             {
                 ConvMults(re, "");
             }
             else
             {
                 ConvMults(re, "To");
             }
             Convbox2.Text = Result;
         }
         catch (Exception)
         {
         }
     }
 }