private void HandleNewAccountAddedEvent(Account newAccount) { if (newAccount == null) { throw new ArgumentNullException("newAccount"); } AccountViewModel newAccountViewModel = new AccountViewModel(newAccount); Application.Current.Dispatcher.Invoke(() => { AccountViewModels.Add(newAccountViewModel); }); }
private void BeginDeleteAccount(AccountViewModel accountVm) { if (accountVm != null) { if (CurrentMailbox.AccountName == accountVm.Account.AccountName) { SelectedTreeViewItem = null; } Task.Run(() => { AccountManager.Instance.DeleteAccount(accountVm.Account); }); } }