using System.Collections.Concurrent;
+using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Diagnostics;
using System.IO;
Settings.Save();
//SetStartupMode();
+ foreach (var account in _accountsToRemove)
+ {
+ Settings.Accounts.Remove(account);
+ Shell.RemoveMonitor(account.AccountName);
+ }
+
foreach (var account in Settings.Accounts)
{
Shell.MonitorAccount(account);
NotifyOfPropertyChange(()=>Settings);
}
+
+ readonly List<AccountSettings> _accountsToRemove = new List<AccountSettings>();
public void RemoveAccount()
{
var accountName = CurrentAccount.AccountName;
- Settings.Accounts.Remove(CurrentAccount.Account);
Accounts.TryRemove(CurrentAccount);
-
-
+ _accountsToRemove.Add(CurrentAccount.Account);
+
CurrentAccount = null;
- //Accounts = Settings.Accounts;
- //Settings.Save();
- Shell.RemoveMonitor(accountName);
NotifyOfPropertyChange(() => Accounts);
- NotifyOfPropertyChange(() => Settings);
+
//NotifyOfPropertyChange("Settings.Accounts");
}