Exemplo n.º 1
0
 /// <summary>
 /// Will check the Operation type flag to see if it is set to default. If it is set to default,
 /// a comparsion is done to see how to add the number to the display. Keeps a running total as well.
 /// For instances where the Default is not set it will change the display to the number selected. Total
 /// is still updated.
 /// </summary>
 /// <param name="value"></param>
 public void EvalulateNumber(int value)
 {
     if (Operation.CompareTo(Flag.Default) == 0)
     {
         //This code block hits if Operation type Flag is set to Default.
         if (ResultLabel.Content.ToString() == "0")
         {
             //Set the display
             ResultLabel.Content = value.ToString();
         }
         else if (!Reset)
         {
             //Set the display
             ResultLabel.Content = $"{ResultLabel.Content}{value}";
         }
         else
         {
             //Set the display
             ResultLabel.Content = value.ToString();
         }
     }
     else
     {
         //Set the display to the value
         ResultLabel.Content = value.ToString();
         //return the Operation to Default
         Operation = Flag.Default;
     }
 }