async void OnRegisterUpdated(object sender, BankingItemUpdatedEventArgs e) { // we need to retrieve the account and set the model property to the account. using (UnitOfWork uow = new UnitOfWork(this.dbFilePath)) { switch (this.AccountType) { case BankAccountType.Checking: var _resultsChecking = Task.Run(() => uow.GetCheckingAccountAsync(model.id)).Result; if (_resultsChecking.Successful) { this.CurrentBalance = _resultsChecking.Results.currentBalance; } break; case BankAccountType.Savings: var _resultsSavings = Task.Run(() => uow.GetSavingsAccountAsync(model.id)).Result; if (_resultsSavings.Successful) { this.CurrentBalance = _resultsSavings.Results.currentBalance; } break; } await GroupAccountItemsAsync(); this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(TotalDeposits))); this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(TotalWithdrawals))); this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(AccountRegisterGrouped))); } }
public void OnItemUpdated() { if (this.ItemUpdated != null) { var args = new BankingItemUpdatedEventArgs(); args.AccountType = Models.BankAccountType.Checking; args.TransactionAmount = this.TransactionAmount; ItemUpdated(this, args); } }