void ReleaseDesignerOutlets()
        {
            if (AmountLabel != null)
            {
                AmountLabel.Dispose();
                AmountLabel = null;
            }

            if (AmountText != null)
            {
                AmountText.Dispose();
                AmountText = null;
            }

            if (ExcellentLabel != null)
            {
                ExcellentLabel.Dispose();
                ExcellentLabel = null;
            }

            if (PercentageLabel != null)
            {
                PercentageLabel.Dispose();
                PercentageLabel = null;
            }

            if (PoorLabel != null)
            {
                PoorLabel.Dispose();
                PoorLabel = null;
            }

            if (RestaurantImageView != null)
            {
                RestaurantImageView.Dispose();
                RestaurantImageView = null;
            }

            if (ServiceLabel != null)
            {
                ServiceLabel.Dispose();
                ServiceLabel = null;
            }

            if (ServiceSlider != null)
            {
                ServiceSlider.Dispose();
                ServiceSlider = null;
            }

            if (TaxAmountText != null)
            {
                TaxAmountText.Dispose();
                TaxAmountText = null;
            }

            if (TaxLabel != null)
            {
                TaxLabel.Dispose();
                TaxLabel = null;
            }

            if (TaxPercentageText != null)
            {
                TaxPercentageText.Dispose();
                TaxPercentageText = null;
            }

            if (TaxSwitch != null)
            {
                TaxSwitch.Dispose();
                TaxSwitch = null;
            }

            if (TipAmountText != null)
            {
                TipAmountText.Dispose();
                TipAmountText = null;
            }

            if (TipCalcLabel != null)
            {
                TipCalcLabel.Dispose();
                TipCalcLabel = null;
            }

            if (TipLabel != null)
            {
                TipLabel.Dispose();
                TipLabel = null;
            }

            if (TipPercentageText != null)
            {
                TipPercentageText.Dispose();
                TipPercentageText = null;
            }

            if (TotalLabel != null)
            {
                TotalLabel.Dispose();
                TotalLabel = null;
            }

            if (TotalText != null)
            {
                TotalText.Dispose();
                TotalText = null;
            }
        }
예제 #2
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            // Perform any additional setup after loading the view, typically from a nib.

            CheckChanges();
            ServiceSlider.ValueChanged += (object sender, EventArgs e) =>
            {
                CheckChanges();
            };

            AmountText.EditingDidEnd += (object sender, EventArgs e) =>
            {
                AmountText.ResignFirstResponder();
                CheckChanges();
            };

            TaxPercentageText.EditingDidEnd += (object sender, EventArgs e) =>
            {
                TaxPercentageText.ResignFirstResponder();
                CheckChanges();
            };
            TaxSwitch.ValueChanged += (object sender, EventArgs e) =>
            {
                UIActionSheet actionSheet;

                string taxMessage = "off";

                //When user tries to turn on
                if (TaxSwitch.On)
                {
                    taxMessage = "on";
                }
                else
                {
                    taxMessage = "off";
                }
                //Display Action Sheet
                actionSheet = new UIActionSheet("Would you like to turn " + taxMessage + "?");

                actionSheet.AddButton("Yes");
                actionSheet.AddButton("No");

                //When user finishes to select an answer
                actionSheet.Clicked += delegate(object a, UIButtonEventArgs b)
                {
                    if (b.ButtonIndex == 1)
                    {
                        TaxSwitch.On = !TaxSwitch.On;
                    }
                    if (!TaxSwitch.On)
                    {
                        TaxPercentageText.Enabled = false;
                    }
                    else
                    {
                        TaxPercentageText.Enabled = true;
                    }
                    CheckChanges();
                };
                actionSheet.ShowInView(View);
            };
        }