X-Git-Url: https://code.grnet.gr/git/pithos-ms-client/blobdiff_plain/2341c6036d5af50def10d2696063955ce199360d..ea0184f3ab941d992d2c45f34c95ab6064c5f961:/trunk/Pithos.Client.WPF/Shell/ShellViewModel.cs diff --git a/trunk/Pithos.Client.WPF/Shell/ShellViewModel.cs b/trunk/Pithos.Client.WPF/Shell/ShellViewModel.cs index 20e941a..f86f46e 100644 --- a/trunk/Pithos.Client.WPF/Shell/ShellViewModel.cs +++ b/trunk/Pithos.Client.WPF/Shell/ShellViewModel.cs @@ -125,6 +125,8 @@ namespace Pithos.Client.WPF { private readonly PollAgent _pollAgent; private readonly NetworkAgent _networkAgent; + [Import] + public Selectives Selectives { get; set; } private MiniStatusViewModel _miniStatus; @@ -316,6 +318,10 @@ namespace Pithos.Client.WPF { PithosMonitor monitor; var accountName = account.AccountName; + MigrateFolders(account); + + Selectives.SetIsSelectiveEnabled(account.AccountKey, account.SelectiveSyncEnabled); + if (Monitors.TryGetValue(account.AccountKey, out monitor)) { //If the account is active @@ -365,8 +371,21 @@ namespace Pithos.Client.WPF { }); } + private void MigrateFolders(AccountSettings account) + { + var oldOthersFolder=Path.Combine(account.RootPath, FolderConstants.OldOthersFolder); + var newOthersFolder = Path.Combine(account.RootPath, FolderConstants.OthersFolder); + var oldFolder = new DirectoryInfo(oldOthersFolder); + var newFolder = new DirectoryInfo(newOthersFolder); + + if (oldFolder.Exists && !newFolder.Exists) + { + oldFolder.MoveTo(newOthersFolder); + } + } + - protected override void OnViewLoaded(object view) + protected override void OnViewLoaded(object view) { UpdateStatus(); var window = (Window)view; @@ -399,6 +418,14 @@ namespace Pithos.Client.WPF { } } + public string TooltipMiniStatus + { + get + { + return String.Format("{0}\r\n{1}", "Status Window", "Enable / Disable the status window"); + } + } + public string ToggleStatusWindowMessage { get @@ -476,6 +503,7 @@ namespace Pithos.Client.WPF { public void ShowPreferences(string currentTab) { //Settings.Reload(); + var preferences = new PreferencesViewModel(_windowManager, _events, this, Settings,currentTab); _windowManager.ShowDialog(preferences); @@ -983,22 +1011,24 @@ namespace Pithos.Client.WPF { #region Event Handlers public void Handle(SelectiveSynchChanges message) - { - PithosMonitor monitor; - if (Monitors.TryGetValue(message.Account.AccountKey, out monitor)) - { - monitor.SetSelectivePaths(message.Uris, message.Added, message.Removed); - - } - - var account = Accounts.FirstOrDefault(acc => acc.AccountKey == message.Account.AccountKey); - if (account!=null) - { - this._pollAgent.SetSelectivePaths(account, message.Added, message.Removed); - } - + { + TaskEx.Run(() => + { + PithosMonitor monitor; + if (Monitors.TryGetValue(message.Account.AccountKey, out monitor)) + { + Selectives.SetIsSelectiveEnabled(message.Account.AccountKey, message.Enabled); + monitor.SetSelectivePaths(message.Uris, message.Added, message.Removed); + } + + var account = Accounts.FirstOrDefault(acc => acc.AccountKey == message.Account.AccountKey); + if (account != null) + { + this._pollAgent.SetSelectivePaths(account, message.Added, message.Removed); + } + }); - } + } private bool _pollStarted;