Ejemplo n.º 1
0
        private async void myWithdraw_Click(object sender, RoutedEventArgs e)
        {
            bool    success = false;
            decimal amount  = 0;

            if (accountList.SelectedIndex != -1)
            {
                decimal.TryParse(amountBox.Text, out amount);
                success = AccountLogic.Withdraw(customer.Accounts[accountList.SelectedIndex], amount);
            }
            MessageDialog withdraw;

            if (success)
            {
                withdraw = new MessageDialog($"{amount} SEK withdrawn", "Withdrawal successful!");
                Frame.Navigate(typeof(AccountPage), customer);
                Frame.GoBack();
            }
            else
            {
                withdraw = new MessageDialog("Withdraw failed...");
            }
            await withdraw.ShowAsync();
        }
 private void myWithdraw_Click(object sender, RoutedEventArgs e)
 {
     decimal.TryParse(withdrawBox.Text, out decimal amount);
     AccountLogic.Withdraw(customer.Accounts[accountList.SelectedIndex], amount);
 }