<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
- <TextBox Name="CurrentAccount_RootPath" Margin="5" HorizontalAlignment="Stretch" Grid.Column="0"/>
+ <TextBox Name="CurrentAccount_RootPath" Margin="5" HorizontalAlignment="Stretch" Grid.Column="0" IsEnabled="False"/>
<Button Name="MoveAccountFolder" Content="Move ..." Width="60" Height="30" Grid.Column="1" />
</Grid>
<CheckBox Name="CurrentAccount_IsActive" Content="Account is Active" Grid.Column="1" Grid.Row="4" Margin="5"/>
private void DoSave()
{
- Settings.Save();
//SetStartupMode();
+ //Ensure we save the settings changes first
foreach (var account in _accountsToRemove)
{
Settings.Accounts.Remove(account);
+ }
+
+ foreach (var account in _accountsToAdd)
+ {
+ Settings.Accounts.Add(account);
+ }
+
+ Settings.Save();
+
+
+ foreach (var account in _accountsToRemove)
+ {
Shell.RemoveMonitor(account.AccountName);
}
}
*/
-
+ readonly List<AccountSettings> _accountsToAdd=new List<AccountSettings>();
public void AddAccount()
{
var wizard = new AddAccountViewModel();
RootPath = actualRootPath,
IsActive=wizard.IsAccountActive
};
- Settings.Accounts.Add(newAccount);
+ _accountsToAdd.Add(newAccount);
var accountVm = new AccountViewModel(newAccount);
(Accounts as IProducerConsumerCollection<AccountViewModel>).TryAdd(accountVm);
CurrentAccount = accountVm;
readonly List<AccountSettings> _accountsToRemove = new List<AccountSettings>();
public void RemoveAccount()
{
- var accountName = CurrentAccount.AccountName;
-
Accounts.TryRemove(CurrentAccount);
_accountsToRemove.Add(CurrentAccount.Account);
return;
var accountInfo=_accounts.FirstOrDefault(account => account.UserName == accountName);
- _accounts.TryRemove(accountInfo);
+ if (accountInfo != null)
+ {
+ _accounts.TryRemove(accountInfo);
+ _pollAgent.RemoveAccount(accountInfo);
+ }
- _pollAgent.RemoveAccount(accountInfo);
- PithosMonitor monitor;
+ PithosMonitor monitor;
if (Monitors.TryRemove(accountName, out monitor))
{
monitor.Stop();