+
+ public void MoveAccountFolder()
+ {
+
+ using (var dlg = new FolderBrowserDialog())
+ {
+ var currentFolder = CurrentAccount.RootPath;
+ dlg.SelectedPath = currentFolder;
+ //Ask the user to select a folder
+ //Note: We need a parent window here, which we retrieve with GetView
+ var view = (Window)GetView();
+ if (DialogResult.OK != dlg.ShowDialog(new Wpf32Window(view)))
+ return;
+
+ var newPath= dlg.SelectedPath;
+ //Find the account's monitor and stop it
+ var monitor = Monitors[CurrentAccount.AccountName];
+ monitor.Stop();
+
+ var oldPath = monitor.RootPath;
+ //The old directory may not exist eg. if we create an account for the first time
+ if (Directory.Exists(oldPath))
+ {
+ //If it does, do the move
+ Directory.Move(oldPath, newPath);
+ //We also need to change the path of the existing file states
+ monitor.MoveFileStates(oldPath, newPath);
+ }
+ //Replace the old rootpath with the new
+ CurrentAccount.RootPath = newPath;
+ //TODO: This will save all settings changes. Too coarse grained, need to fix at a later date
+ Settings.Save();
+ //And start the monitor on the new RootPath
+ monitor.RootPath = newPath;
+ monitor.Start();
+ //Finally, notify that the Settings, CurrentAccount have changed
+ NotifyOfPropertyChange(() => CurrentAccount);
+ NotifyOfPropertyChange(() => Settings);
+
+ }
+ }