private async Task GetHistoryOfAccount() { if (SelectedAccount == null) { throw new ArgumentException("Please select account"); } HistoryOfAccount = await ServiceBankExecutor.GetHistoryOfAccount(SelectedAccount.Number, CurrentPage - 1, SizePage); CountAllOfPages = HistoryOfAccount.CountOfAllPages; }
public MainViewModel() { _tokenTimeToLive = ServiceBankExecutor.GetTokenTtl(); var dt = new DispatcherTimer(); _stopWatch = new Stopwatch(); dt.Tick += dt_Tick; dt.Interval = new TimeSpan(0, 0, 0, 0, 10); _stopWatch.Start(); dt.Start(); }
private async Task GetAccounts() { var accounts = await ServiceBankExecutor.GetAccounts(); if (Accounts == null) { Accounts = accounts; } else { foreach (var account in Accounts) { account.Balance = accounts.FirstOrDefault(q => q.Number == account.Number).Balance; } } }
private async void LoginAction(object parameter) { VisibilityProgress = Visibility.Visible; VisibilityForm = Visibility.Collapsed; var password = ((PasswordBox)parameter).Password; try { int id; if (!int.TryParse(IdClient, out id)) { throw new Exception("The Id Client is incorrect."); } await ServiceBankExecutor.Login(id, password); await Application.Current.Dispatcher.BeginInvoke( DispatcherPriority.Background, new Action(ShowMainWindow)); await Application.Current.Dispatcher.BeginInvoke( DispatcherPriority.Background, CloseAction); } catch (FaultException ex) { Error = ex.Message; } catch (Exception ex) { //todo log exception Error = "Service bank is not available, please try later."; } VisibilityForm = Visibility.Visible; VisibilityProgress = Visibility.Collapsed; }
private async Task CreatePayIn() { await ServiceBankExecutor.PayIn(GetSelectedAccount(), GetAmount()); Success = "Success PayIn"; }
private async Task CreateTransfer() { await ServiceBankExecutor.Transfer(GetSelectedAccount(), AccountTo, GetAmount(), Title); Success = "Success Transfer"; }