protected virtual void HandleDateStateChange(DateStateViewModel dateState) { dateState.WhenDateStateChanged.Subscribe((state) => { IsLoading = true; }); }
protected AccountsBaseViewModel(DataLoader dataLoader, Auditor auditor, DateStateViewModel dateState) { Accounts = new ObservableCollection <AccountViewModel>(); AccountsById = new Dictionary <long, AccountViewModel>(); _auditor = auditor; _dataLoader = dataLoader; _dateStateVm = dateState; HandleAuditorNotifications(auditor); LoadAccountsFromProfile(dataLoader.ProfileManager.UserProfiles, dataLoader); HandleAccountLoading(dataLoader); HandleDateStateChange(dateState); RemoveAccount = new RelayCommand(a => { var accountVm = a as AccountViewModel; if (accountVm == null) { return; } Accounts.Remove(accountVm); _dataLoader.ProfileManager.RemoveUserAccountProfile(accountVm.ToUserAccountProfile()); }); }
public IncomeViewModel(DataLoader dataLoader, Auditor auditor, DateStateViewModel dateState) : base(dataLoader, auditor, dateState) { Transactions = new ObservableCollection <TransactionViewModel>(); HandleIncomeTransactions(dataLoader); HandleAccountsLoading(); TransactionsView = CollectionViewSource.GetDefaultView(Transactions); TransactionsView.Filter = TransactionsFilter; TransactionsView.SortDescriptions.Add(new SortDescription("Date", ListSortDirection.Descending)); }
protected override void HandleDateStateChange(DateStateViewModel dateState) { base.HandleDateStateChange(dateState); dateState.WhenDateStateChanged.Subscribe((state) => { Transactions.Clear(); foreach (var category in Categories) { category.Spent = 0; } }); }
public BudgetViewModel(DataLoader dataLoader, Auditor auditor, DateStateViewModel dateState, CategoriesViewModel categories) : base(dataLoader, auditor, dateState) { Transactions = new ObservableCollection <TransactionViewModel>(); CreateCommands(); PopulateCategories(categories); HandleExpenseTransactions(dataLoader); TransactionsView = CollectionViewSource.GetDefaultView(Transactions); TransactionsView.Filter = TransactionsFilter; TransactionsView.SortDescriptions.Add(new SortDescription("Date", ListSortDirection.Descending)); }
private void HandleDateStateChange(DateStateViewModel dateState, DataLoader dataLoader, AccountsViewModel accountsVm) { dateState.WhenDateStateChanged.Subscribe((state) => { var firstDayOfMonth = new DateTime(state.Year, state.Month, 1); var lastDayOfMonth = firstDayOfMonth.AddMonths(1).AddDays(-1); foreach (var accountVm in accountsVm.Accounts) { dataLoader.LoadAccount(accountVm.Account, firstDayOfMonth, lastDayOfMonth); } }); }
protected override void HandleDateStateChange(DateStateViewModel dateState) { base.HandleDateStateChange(dateState); dateState.WhenDateStateChanged.Subscribe((state) => { foreach (var accountVm in Accounts) { accountVm.RemoveAllTransactions(); if (accountVm.Account != null) { accountVm.IsLoading = true; } } }); }
public AccountsViewModel(DataLoader dataLoader, Auditor auditor, DateStateViewModel dateState) : base(dataLoader, auditor, dateState) { CreateCommands(); }
internal DateStateEventArgs(DateStateViewModel dateState) { DateState = dateState; }
public MainViewModel(DataLoader dataLoader, ToolbarViewModel toolbarVm, AccountsViewModel accountsVm, NewAccountViewModel newAccountVm, NewCategoryViewModel newCategoryVm, BudgetViewModel budgetVm, DateStateViewModel dateState) { Toolbar = toolbarVm; NewAccount = newAccountVm; NewCategory = newCategoryVm; accountsVm.WhenShowNewAccountExecuted.Subscribe((e) => { ShowAddNewAccountLayout = true; }); budgetVm.WhenShowNewCategoryExecuted.Subscribe((e) => { ShowAddNewCategoryLayout = true; }); HandleDateStateChange(dateState, dataLoader, accountsVm); }