Fixed Check initialization bug in Selective Synch
authorPanagiotis Kanavos <pkanavos@gmail.com>
Mon, 23 Apr 2012 18:26:50 +0000 (21:26 +0300)
committerPanagiotis Kanavos <pkanavos@gmail.com>
Mon, 23 Apr 2012 18:26:50 +0000 (21:26 +0300)
trunk/Pithos.Client.WPF/FileProperties/ConflictsViewModel.cs
trunk/Pithos.Client.WPF/SelectiveSynch/DirectoryRecord.cs
trunk/Pithos.Client.WPF/SelectiveSynch/SelectiveSynchViewModel.cs

index d62049d..b49bbee 100644 (file)
@@ -133,12 +133,12 @@ namespace Pithos.Client.WPF.FileProperties
                             select conflict;
             Resolver.Resolve(conflicts);
             
-            TryClose(true);
+            TryClose();
         }
 
         public void Cancel()
         {
-            TryClose(false);
+            TryClose();
         }
 
         
index 2ef1867..ce139fe 100644 (file)
@@ -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)
index 71074a8..bc9ea54 100644 (file)
@@ -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; }