From: Panagiotis Kanavos Date: Mon, 23 Apr 2012 18:26:50 +0000 (+0300) Subject: Fixed Check initialization bug in Selective Synch X-Git-Url: https://code.grnet.gr/git/pithos-ms-client/commitdiff_plain/5c46341ddfca483022e30a0c841627cf13b70fc6 Fixed Check initialization bug in Selective Synch --- diff --git a/trunk/Pithos.Client.WPF/FileProperties/ConflictsViewModel.cs b/trunk/Pithos.Client.WPF/FileProperties/ConflictsViewModel.cs index d62049d..b49bbee 100644 --- a/trunk/Pithos.Client.WPF/FileProperties/ConflictsViewModel.cs +++ b/trunk/Pithos.Client.WPF/FileProperties/ConflictsViewModel.cs @@ -133,12 +133,12 @@ namespace Pithos.Client.WPF.FileProperties select conflict; Resolver.Resolve(conflicts); - TryClose(true); + TryClose(); } public void Cancel() { - TryClose(false); + TryClose(); } diff --git a/trunk/Pithos.Client.WPF/SelectiveSynch/DirectoryRecord.cs b/trunk/Pithos.Client.WPF/SelectiveSynch/DirectoryRecord.cs index 2ef1867..ce139fe 100644 --- a/trunk/Pithos.Client.WPF/SelectiveSynch/DirectoryRecord.cs +++ b/trunk/Pithos.Client.WPF/SelectiveSynch/DirectoryRecord.cs @@ -214,7 +214,9 @@ namespace Pithos.Client.WPF.SelectiveSynch public override int GetHashCode() { - return ObjectInfo.GetHashCode(); + return ObjectInfo == null + ? (Uri == null ? DisplayName.GetHashCode() : Uri.GetHashCode()) + : ObjectInfo.GetHashCode(); } public override bool Equals(object obj) diff --git a/trunk/Pithos.Client.WPF/SelectiveSynch/SelectiveSynchViewModel.cs b/trunk/Pithos.Client.WPF/SelectiveSynch/SelectiveSynchViewModel.cs index 71074a8..bc9ea54 100644 --- a/trunk/Pithos.Client.WPF/SelectiveSynch/SelectiveSynchViewModel.cs +++ b/trunk/Pithos.Client.WPF/SelectiveSynch/SelectiveSynchViewModel.cs @@ -170,12 +170,22 @@ namespace Pithos.Client.WPF.SelectiveSynch //Initially, all nodes are checked //We need to *uncheck* the nodes that are not selected - var selects = from DirectoryRecord rootRecord in RootNodes + var allNodes = (from DirectoryRecord rootRecord in RootNodes + from DirectoryRecord record in rootRecord + select record).ToList(); + + var selects = (from DirectoryRecord rootRecord in RootNodes from DirectoryRecord record in rootRecord where record.Uri !=null && !selections.Contains(record.Uri.ToString()) - select record; + select record).ToList(); + var shouldBeChecked = allNodes.Except(selects).ToList(); selects.Apply(record=>record.IsChecked=false); + + shouldBeChecked.Apply(record => record.IsChecked = true); + + + } protected string AccountName { get; set; }