예제 #1
0
 private void Delit_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (ResClass.operation == 4)
         {
             ResClass.b          = Convert.ToDouble(this.Resault.Text);
             ResClass.a          = ResClass.Get_Resault(ResClass.operation, ResClass.a, ResClass.b);
             this.Resault.Text   = "";
             this.Dot.IsEnabled  = true;
             this.Zero.IsEnabled = true;
         }
         else
         {
             ResClass.a          = Convert.ToDouble(this.Resault.Text);
             this.Resault.Text   = "";
             ResClass.operation  = 4;
             this.Dot.IsEnabled  = true;
             this.Zero.IsEnabled = true;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("I spotted an error in your number\nYou better fix it");
     }
 }
예제 #2
0
 private void Square_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         ResClass.operation  = 6;
         ResClass.a          = Convert.ToDouble(this.Resault.Text);
         this.Resault.Text   = $"{ResClass.Get_Resault(ResClass.operation, ResClass.a, ResClass.b).ToString()}";
         this.Zero.IsEnabled = true;
         if (!this.Resault.Text.Contains(','))
         {
             this.Dot.IsEnabled = true;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("I spotted an error\nTry again or send a message on GitHub");
     }
 }
예제 #3
0
 private void Resault_Button_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         ResClass.b = Convert.ToDouble(this.Resault.Text);
         if (ResClass.b == 0 && ResClass.operation == 4)
         {
             MessageBox.Show("You can't do it because of 'Zero' number");
         }
         else
         {
             ResClass.Resault_copy = ResClass.Get_Resault(ResClass.operation, ResClass.a, ResClass.b).ToString();
             if (ResClass.Resault_copy.Length > 12 && ResClass.Resault_copy.Contains(',') == true)
             {
                 while (ResClass.Resault_copy.Contains(','))
                 {
                     ResClass.Resault_copy = ResClass.Resault_copy.Remove(ResClass.Resault_copy.Length - 1);
                     ResClass.lenth        = ResClass.Resault_copy.Length;
                 }
                 this.Resault.Text = $"{Math.Round(ResClass.Get_Resault(ResClass.operation, ResClass.a, ResClass.b), 12 - ResClass.lenth)}";
             }
             else if (ResClass.Resault_copy.Length > 12 && ResClass.Resault_copy.Contains(',') == false)
             {
                 ResClass.Resault  = ResClass.Get_Resault(ResClass.operation, ResClass.a, ResClass.b);
                 this.Resault.Text = $"{Math.Round(ResClass.Resault * Math.Pow(10, -(ResClass.Resault_copy.Length - 1)), 2)}E+{ResClass.Resault_copy.Length - 1}";
             }
             else
             {
                 this.Resault.Text = $"{ResClass.Get_Resault(ResClass.operation, ResClass.a, ResClass.b).ToString()}";
             }
         }
         ResClass.operation  = 0;
         this.Dot.IsEnabled  = true;
         this.Zero.IsEnabled = true;
     }
     catch (Exception ex)
     {
         MessageBox.Show("Something've gone wrong\nWe are working on solution to this problem");
     }
 }
예제 #4
0
 private void Stepen_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (ResClass.operation == 5)
         {
             ResClass.b        = Convert.ToDouble(this.Resault.Text);
             ResClass.a        = ResClass.Get_Resault(ResClass.operation, ResClass.a, ResClass.b);
             this.Resault.Text = "";
         }
         else
         {
             ResClass.a         = Convert.ToDouble(this.Resault.Text);
             this.Resault.Text  = "";
             ResClass.operation = 5;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("I spotted an error\nTry again or send a message on GitHub");
     }
 }