/// <summary>
 /// Invoked when this page is about to be displayed in a Frame.
 /// </summary>
 /// <param name="e">Event data that describes how this page was reached.
 /// This parameter is typically used to configure the page.</param>
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     tipAttributes = new TipAttributes
     {
         IncludeTaxInTip     = true,
         Subtotal            = 0,
         TaxRate             = 0,
         TaxAmount           = 0,
         PretipTotal         = 0,
         TipPercentage       = 0,
         TipAmount           = 0,
         Total               = 0,
         updateSubtotal      = new TipCalculator.UpdateSubtotal(this.UpdateSubtotal),
         updateTaxAmount     = new TipCalculator.UpdateTaxAmount(this.UpdateTaxAmount),
         updateTaxRate       = new TipCalculator.UpdateTaxRate(this.UpdateTaxRate),
         updatePretipTotal   = new TipCalculator.UpdatePretipTotal(this.UpdatePretip),
         updateTipPercentage = new TipCalculator.UpdateTipPercentage(this.UpdateTipPercentage),
         updateTipAmount     = new TipCalculator.UpdateTipAmount(this.UpdateTipAmount),
         updateTotal         = new TipCalculator.UpdateTotal(this.UpdateTotal)
     };
 }
 public MainPage()
 {
     this.InitializeComponent();
     tipAttributes = new TipAttributes
     {
         IncludeTaxInTip     = true,
         Subtotal            = 0,
         TaxRate             = 0,
         TaxAmount           = 0,
         PretipTotal         = 0,
         TipPercentage       = 0,
         TipAmount           = 0,
         Total               = 0,
         updateSubtotal      = new TipCalculator.UpdateSubtotal(this.UpdateSubtotal),
         updateTaxAmount     = new TipCalculator.UpdateTaxAmount(this.UpdateTaxAmount),
         updateTaxRate       = new TipCalculator.UpdateTaxRate(this.UpdateTaxRate),
         updatePretipTotal   = new TipCalculator.UpdatePretipTotal(this.UpdatePretip),
         updateTipPercentage = new TipCalculator.UpdateTipPercentage(this.UpdateTipPercentage),
         updateTipAmount     = new TipCalculator.UpdateTipAmount(this.UpdateTipAmount),
         updateTotal         = new TipCalculator.UpdateTotal(this.UpdateTotal)
     };
 }
 public void UpdateTipAmount(float tipAmount)
 {
     TipAmountTB.Text = TipAttributes.priceToString(tipAmount);
 }
 public void UpdateTipPercentage(float tipPercentage)
 {
     TipPercentageTB.Text = TipAttributes.percentageToString(tipPercentage);
 }
 public void UpdatePretip(float pretip)
 {
     PretipTB.Text = TipAttributes.priceToString(pretip);
 }
 public void UpdateSubtotal(float subtotal)
 {
     SubtotalTB.Text = TipAttributes.priceToString(subtotal);
 }
 public void UpdateTaxRate(float taxRate)
 {
     TaxRateTB.Text = TipAttributes.percentageToString(taxRate) + "%";
 }
 public void UpdateTaxAmount(float taxAmount)
 {
     TaxTB.Text = "$" + TipAttributes.priceToString(taxAmount);
 }
 public void UpdateTotal(float total)
 {
     TotalTB.Text = TipAttributes.priceToString(total);
 }