Exemple #1
0
 /// <summary>
 /// Calculate the change to give
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void OnCalculateChange(object sender, RoutedEventArgs e)
 {
     if (manager.Hand.TotalValue < total)
     {
         parent.MessageBox.Text = "Error: Not Enough Money for Transaction";
     }
     else
     {
         parent.Transaction.AmountPaid = manager.Hand.TotalValue;
         try
         {
             parent.MessageBox.Text = $"Change To Give:\n{manager.CalculateChange(total)}";
             DoneButton.IsEnabled   = true;
             ChangeButton.IsEnabled = false;
         }
         catch (InvalidOperationException ex)
         { // Unable to give change
             parent.MessageBox.Text = "Error: Unable to give change. Try paying a smaller amount";
         }
     }
 }