/// <summary> /// Called to refresh the list of accounts from the database /// </summary> public void UpdateAccounts() { var accountsByType = new Dictionary<string, ObservableCollection<Account>>(); // Retrieve the accounts from the database using (var dataService = new DataService()) { // Map all accounts by type foreach (var account in dataService.GetAccountsWithFi()) { // Add category if needed ObservableCollection<Account> accountList; if (!accountsByType.ContainsKey(account.AccountType)) { accountList = new ObservableCollection<Account>(); accountsByType.Add(account.AccountType, accountList); } else { accountList = accountsByType[account.AccountType]; } // Add to the list under this type accountList.Add(account); } } // Store in cached view _accountsView = accountsByType; // Clear cache of summary data ClearSummaryCache(); // Notify of property update RaisePropertyChanged(() => AccountsView); }