Esempio n. 1
0
        private void confirmButtonPress(object sender, MouseButtonEventArgs e)
        {
            UITimers timer;

            if (!(output == null || output == ""))
            {
                int amount = Convert.ToInt32(output);
                timer = new UITimers();
                if (amount != 0 && amount % 5 == 0 && amount < customer.getBalance())
                {
                    caller.setAmount(amount);
                    WithdrawConfirmPopup confirm = new WithdrawConfirmPopup(caller, customer.getSymbol() + output, customer);
                    confirm.Show();
                    this.Close();
                }
                else if (amount > customer.getBalance())
                {
                    WithdrawErrorPopup errorPopup = new WithdrawErrorPopup();
                    errorPopup.Show();

                    output            = "";
                    amountOutput.Text = "";
                }
                else if (amount == 0 || amount % 5 != 0)
                {
                    timer.colorTimer(amountOutput, new SolidColorBrush(Color.FromArgb(0xFF, 0xF3, 0x5A, 0x5A)), 20);
                }
            }
            else
            {
                timer = new UITimers();
                timer.colorTimer(amountOutput, new SolidColorBrush(Color.FromArgb(0xFF, 0xF3, 0x5A, 0x5A)), 20);
            }
        }
        private void WithdrawButtonPush(object sender, MouseButtonEventArgs e)
        {
            Label label   = (Label)sender;
            int   ammount = Convert.ToInt32(label.Content.ToString().Split('£')[1]);

            if (customer.withdraw(ammount))
            {
                Console.WriteLine("Success");
                WithdrawConfirmPopup confirm = new WithdrawConfirmPopup(this, label.Content.ToString(), customer);
                confirm.Show();
            }
            else
            {
                Console.WriteLine("Not Enough Funds");
                UITimers           timer      = new UITimers();
                WithdrawErrorPopup errorPopup = new WithdrawErrorPopup();
                errorPopup.Show();
                timer.popUpWindowTimer(errorPopup, 15);
            }
        }