/// <summary> /// This handles when the <see cref="IUserRepository.GetAllUsersCompleted"/> is raise. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void UserRepositorySaveUserCompleted(object sender, RepositoryTaskFinishedEventArgs e) { ThreadSafeInvoke(() => { _messagingService.CloseProgressMessage(); if (e.HasError) { _messagingService.ShowMessage(UIText.ERROR_OCCURED_MSG); } if (!Users.Contains(SelectedUser)) { Users.Add(SelectedUser); OnPropertyChanged(GetPropertyName(() => SelectedUser)); SelectedUser.Refresh(); } }); }
/// <summary> /// This handler handles the event when the <see cref="ITransactionRepository.SaveTransactionCompleted"/> /// event is raised by <see cref="_transactionRepository"/>. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void TransactionRepositorySaveTransactionCompleted(object sender, RepositoryTaskFinishedEventArgs e) { ThreadSafeInvoke(() => { _messagingService.CloseProgressMessage(); if (e.HasError) { _messagingService.ShowMessage(UIText.ERROR_OCCURED_MSG); } if (!Transactions.Contains(SelectedTransaction)) { Transactions.Add(SelectedTransaction); if (null != SelectedTransaction)//Redundant but safe check SelectedTransaction.Refresh(); TotalIncome = Transactions.Where(t => t.FlowType == TransactionFlowType.Income).Sum(t => t.Entity.Amount); TotalExpenditure = Transactions.Where(t => t.FlowType == TransactionFlowType.Expenditure).Sum(t => t.Entity.Amount); GraphItems = GetGraphData(Transactions.Select(t => t.Entity).ToList()); } }); }