示例#1
0
 private void Backspace_Click(object sender, RoutedEventArgs e)
 {
     Error();
     if (read != false)
     {
         if (!input.Text.Equals("0"))
         {
             if ((input.Text.Length == 2 && Double.Parse(input.Text.Replace(',', '.'), CultureInfo.InvariantCulture) < 0) || input.Text.Length == 1)
             {
                 input.Text = "0";
             }
             else
             {
                 input.Text = input.Text.Remove(input.Text.Length - 1, 1);
             }
         }
     }
     else
     {
         if (memory.Text.Length != 0)
         {
             memory.Text = "";
         }
     }
     Logic.Resize(input);
 }
示例#2
0
        private void Number_Click(object sender, RoutedEventArgs e)
        {
            Error();
            Button button = (Button)sender;
            string num    = button.Content.ToString();

            if (read == false)
            {
                if (memory.Text.Length != 0 && memory.Text.Last() == '=')
                {
                    memory.Text = "";
                }
                input.Text = num;
                read       = true;
            }
            else
            {
                if (input.Text.Equals("0"))
                {
                    input.Text = num;
                }
                else
                {
                    if (input.Text.Length < 21)
                    {
                        input.Text += num;
                    }
                }
            }
            Logic.Resize(input);
        }
示例#3
0
 private void ClearAll_Click(object sender, RoutedEventArgs e)
 {
     input.Text  = "0";
     memory.Text = "";
     read        = false;
     Logic.Resize(input);
 }
示例#4
0
 private void Clear_Click(object sender, RoutedEventArgs e)
 {
     Error();
     input.Text = "0";
     read       = true;
     Logic.Resize(input);
 }
示例#5
0
        private void Action_Click(object sender, RoutedEventArgs e)
        {
            Error();
            Button btn = (Button)sender;

            Logic.DoMath(input, memory, btn.Content.ToString().First(), ref error, ref read, ref last);
            Logic.Resize(input);
        }
示例#6
0
 private void Point_Click(object sender, RoutedEventArgs e)
 {
     Error();
     if (!input.Text.Contains(',') && input.Text.Length < 21)
     {
         input.Text += ',';
         Logic.Resize(input);
         read = true;
     }
 }
示例#7
0
 private void Zero_Click(object sender, RoutedEventArgs e)
 {
     Error();
     if (read == false)
     {
         input.Text = "0";
         read       = true;
     }
     else if (!input.Text.Equals("0") && input.Text.Length < 21)
     {
         input.Text += '0';
         Logic.Resize(input);
     }
 }
示例#8
0
 private void Negation_Click(object sender, RoutedEventArgs e)
 {
     Error();
     if (Double.Parse(input.Text.Replace(',', '.'), CultureInfo.InvariantCulture) != 0)
     {
         if (Double.Parse(input.Text.Replace(',', '.'), CultureInfo.InvariantCulture) < 0)
         {
             input.Text = input.Text.Remove(0, 1);
         }
         else
         {
             if (input.Text.Length < 21)
             {
                 input.Text = '-' + input.Text;
             }
         }
     }
     read = true;
     Logic.Resize(input);
 }