commit 4759a79c2cba434d27a7384444f95e299bd1277a
Author: George Pantazis <gpant@noc.grnet.gr>
Date:   Fri May 4 18:49:45 2012 +0300

    New check to enable/disable selective sync
    Fixed tooltip for the status in the context menu of the taskbar icon, to show its also a toggle for the status window.
    
    Signed-off-by: George Pantazis <gpant@noc.grnet.gr>

diff --git a/trunk/Pithos.Client.WPF/SelectiveSynch/DirectoryRecord.cs b/trunk/Pithos.Client.WPF/SelectiveSynch/DirectoryRecord.cs
index 8355103..d9dd48f 100644
--- a/trunk/Pithos.Client.WPF/SelectiveSynch/DirectoryRecord.cs
+++ b/trunk/Pithos.Client.WPF/SelectiveSynch/DirectoryRecord.cs
@@ -1,265 +1,265 @@
-﻿#region
-/* -----------------------------------------------------------------------
- * <copyright file="DirectoryRecord.cs" company="GRNet">
- * 
- * Copyright 2011-2012 GRNET S.A. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or
- * without modification, are permitted provided that the following
- * conditions are met:
- *
- *   1. Redistributions of source code must retain the above
- *      copyright notice, this list of conditions and the following
- *      disclaimer.
- *
- *   2. Redistributions in binary form must reproduce the above
- *      copyright notice, this list of conditions and the following
- *      disclaimer in the documentation and/or other materials
- *      provided with the distribution.
- *
- *
- * THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and
- * documentation are those of the authors and should not be
- * interpreted as representing official policies, either expressed
- * or implied, of GRNET S.A.
- * </copyright>
- * -----------------------------------------------------------------------
- */
-#endregion
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Collections.Specialized;
-using System.Diagnostics;
-using System.IO;
-using System.Linq;
-using System.Text;
-using Caliburn.Micro;
-using Pithos.Client.WPF.Utils;
-using Pithos.Core.Agents;
-using Pithos.Interfaces;
-
-namespace Pithos.Client.WPF.SelectiveSynch
-{
-    [DebuggerDisplay("{Uri} : {IsChecked}")]
-    public class DirectoryRecord :PropertyChangedBase, IEnumerable<DirectoryRecord>
-    {
-        private ObjectInfo _objectInfo;
-        public ObjectInfo ObjectInfo
-        {
-            get { return _objectInfo; }
-            set
-            {
-                _objectInfo = value;
-                Uri = value.Uri;
-            }
-        }
-
-        public Uri Uri { get; set; }
-        //public DirectoryInfo LocalInfo { get; set; }
-
-        DirectoryRecord _parent;
-
-        public bool Added { get; set; }
-        public bool Removed { get; set; }
-
-        private bool? _isChecked=true;
-        #region IsChecked
-
-        /// <summary>
-        /// Gets/sets the state of the associated UI toggle (ex. CheckBox).
-        /// The return value is calculated based on the check state of all
-        /// child FooViewModels.  Setting this property to true or false
-        /// will set all children to the same check state, and setting it 
-        /// to any value will cause the parent to verify its check state.
-        /// </summary>
-        public bool? IsChecked
-        {
-            get { return _isChecked; }
-            set { this.SetIsChecked(value, true, true); }
-        }
-
-        void SetIsChecked(bool? value, bool updateChildren, bool updateParent)
-        {
-            if (value == _isChecked)
-                return;
-
-            _isChecked = value;
-
-            //If the value is null both Added and Removed should be False
-            Added = _isChecked??false;
-            Removed = !(_isChecked??true);
-
-            if (updateChildren && _isChecked.HasValue)
-                this.Directories.Apply(c => c.SetIsChecked(_isChecked, true, false));
-
-            if (updateParent && _parent != null)
-                _parent.VerifyCheckState();
-
-            this.RaisePropertyChangedEventImmediately("IsChecked");
-        }
-
-        void VerifyCheckState()
-        {
-            bool? state = null;
-            for (var i = 0; i < this.Directories.Count(); ++i)
-            {
-                bool? current = this.Directories.ElementAt(i).IsChecked;
-                if (i == 0)
-                {
-                    state = current;
-                }
-                else if (state != current)
-                {
-                    state = null;
-                    break;
-                }
-            }
-            this.SetIsChecked(state, false, true);
-        }
-
-        #endregion // IsChecked
-
-
-        public bool IsInitiallySelected { get; private set; }
-
-        private List<DirectoryRecord>  _directories=new List<DirectoryRecord>();
-        public List<DirectoryRecord> Directories
-        {
-            get { return _directories; }
-            set { _directories= value; }
-        }
-
-        public DirectoryRecord()
-        {
-            
-/*
-             _directories = new Lazy<List<DirectoryRecord>>(() => 
-                new List<DirectoryRecord>());
-*/
-/*
-             _directories = new Lazy<List<DirectoryRecord>>(() => 
-                (from directory in Info.EnumerateDirectories("*", SearchOption.TopDirectoryOnly)
-                where !directory.FullName.StartsWith(ignorePath)
-                select new DirectoryRecord(ignorePath) { Info = directory }).ToList());
-*/
-        }
-
-        private string _displayName;
-
-        public string DisplayName
-        {
-            get
-            {
-                if (ObjectInfo != null)
-                    return ObjectInfo.Name.Split('/').Last();
-                return _displayName;
-            }
-            set { _displayName = value; }
-        }
-
-        public bool IsExplicitlyChecked
-        {
+﻿#region
+/* -----------------------------------------------------------------------
+ * <copyright file="DirectoryRecord.cs" company="GRNet">
+ * 
+ * Copyright 2011-2012 GRNET S.A. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ *   1. Redistributions of source code must retain the above
+ *      copyright notice, this list of conditions and the following
+ *      disclaimer.
+ *
+ *   2. Redistributions in binary form must reproduce the above
+ *      copyright notice, this list of conditions and the following
+ *      disclaimer in the documentation and/or other materials
+ *      provided with the distribution.
+ *
+ *
+ * THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and
+ * documentation are those of the authors and should not be
+ * interpreted as representing official policies, either expressed
+ * or implied, of GRNET S.A.
+ * </copyright>
+ * -----------------------------------------------------------------------
+ */
+#endregion
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Collections.Specialized;
+using System.Diagnostics;
+using System.IO;
+using System.Linq;
+using System.Text;
+using Caliburn.Micro;
+using Pithos.Client.WPF.Utils;
+using Pithos.Core.Agents;
+using Pithos.Interfaces;
+
+namespace Pithos.Client.WPF.SelectiveSynch
+{
+    [DebuggerDisplay("{Uri} : {IsChecked}")]
+    public class DirectoryRecord :PropertyChangedBase, IEnumerable<DirectoryRecord>
+    {
+        private ObjectInfo _objectInfo;
+        public ObjectInfo ObjectInfo
+        {
+            get { return _objectInfo; }
+            set
+            {
+                _objectInfo = value;
+                Uri = value.Uri;
+            }
+        }
+
+        public Uri Uri { get; set; }
+        //public DirectoryInfo LocalInfo { get; set; }
+
+        DirectoryRecord _parent;
+
+        public bool Added { get; set; }
+        public bool Removed { get; set; }
+
+        private bool? _isChecked=true;
+        #region IsChecked
+
+        /// <summary>
+        /// Gets/sets the state of the associated UI toggle (ex. CheckBox).
+        /// The return value is calculated based on the check state of all
+        /// child FooViewModels.  Setting this property to true or false
+        /// will set all children to the same check state, and setting it 
+        /// to any value will cause the parent to verify its check state.
+        /// </summary>
+        public bool? IsChecked
+        {
+            get { return _isChecked; }
+            set { this.SetIsChecked(value, true, true); }
+        }
+
+        void SetIsChecked(bool? value, bool updateChildren, bool updateParent)
+        {
+            if (value == _isChecked)
+                return;
+
+            _isChecked = value;
+
+            //If the value is null both Added and Removed should be False
+            Added = _isChecked??false;
+            Removed = !(_isChecked??true);
+
+            if (updateChildren && _isChecked.HasValue)
+                this.Directories.Apply(c => c.SetIsChecked(_isChecked, true, false));
+
+            if (updateParent && _parent != null)
+                _parent.VerifyCheckState();
+
+            this.RaisePropertyChangedEventImmediately("IsChecked");
+        }
+
+        void VerifyCheckState()
+        {
+            bool? state = null;
+            for (var i = 0; i < this.Directories.Count(); ++i)
+            {
+                bool? current = this.Directories.ElementAt(i).IsChecked;
+                if (i == 0)
+                {
+                    state = current;
+                }
+                else if (state != current)
+                {
+                    state = null;
+                    break;
+                }
+            }
+            this.SetIsChecked(state, false, true);
+        }
+
+        #endregion // IsChecked
+
+
+        public bool IsInitiallySelected { get; private set; }
+
+        private List<DirectoryRecord>  _directories=new List<DirectoryRecord>();
+        public List<DirectoryRecord> Directories
+        {
+            get { return _directories; }
+            set { _directories= value; }
+        }
+
+        public DirectoryRecord()
+        {
+            
+/*
+             _directories = new Lazy<List<DirectoryRecord>>(() => 
+                new List<DirectoryRecord>());
+*/
+/*
+             _directories = new Lazy<List<DirectoryRecord>>(() => 
+                (from directory in Info.EnumerateDirectories("*", SearchOption.TopDirectoryOnly)
+                where !directory.FullName.StartsWith(ignorePath)
+                select new DirectoryRecord(ignorePath) { Info = directory }).ToList());
+*/
+        }
+
+        private string _displayName;
+
+        public string DisplayName
+        {
+            get
+            {
+                if (ObjectInfo != null)
+                    return ObjectInfo.Name.Split('/').Last();
+                return _displayName;
+            }
+            set { _displayName = value; }
+        }
+
+        public bool IsExplicitlyChecked
+        {
             set
             {
                 _isChecked=value;
                 this.RaisePropertyChangedEventImmediately("IsChecked");
-            }
-        }
-
-        public DirectoryRecord(ObjectInfo info)
-        {
-            ObjectInfo = info;
-        }
-
-
-/*
-        public IEnumerable<DirectoryInfo> GetCheckedDirectories()
-        {
-            var q = from record in this
-                    where record.IsChecked==true
-                    select record.Info;
-            return q;
-        }
-*/
-
-/*
-        public void SetSelections(StringCollection selections)
-        {
-            IsChecked=selections.Contains(Info.FullName);                
-            foreach (var children in Directories)
-            {
-                children.SetSelections(selections);
-            }
-        }
-*/
-
-
-        public IEnumerator<DirectoryRecord> GetEnumerator()
-        {
-            yield return this;
-            foreach (var children in Directories)
-                foreach (var info in children)
-                {
-                    yield return info;
-                }
-        }
-
-        IEnumerator IEnumerable.GetEnumerator()
-        {
-            return GetEnumerator();
-        }
-
-        public override int GetHashCode()
-        {
-            return ObjectInfo == null
-                       ? (Uri == null ? DisplayName.GetHashCode() : Uri.GetHashCode())
-                       : ObjectInfo.GetHashCode();
-        }
-
-        public override bool Equals(object obj)
-        {
-            if (!(obj is DirectoryRecord))
-                return false;
-            var other = (DirectoryRecord)obj;
-            if (Uri != other.Uri)
-                return false;
-            if (ObjectInfo== null ^ other.ObjectInfo== null)
-                return false;
-
-            if (ObjectInfo!= null && !ObjectInfo.Equals(other.ObjectInfo))
-                return false;
-            var thisEnum = GetEnumerator();
-            var otherEnum = other.GetEnumerator();
-            //Skipt the first item, it is the current node itself
-            thisEnum.MoveNext();
-            otherEnum.MoveNext();
-            while (true)
-            {
-                var thisMove = thisEnum.MoveNext();
-                var otherMove = otherEnum.MoveNext();
-
-                if (thisMove ^ otherMove)
-                    return false;
-                if (!thisMove)
-                    return true;
-
-                if (!thisEnum.Current.Equals(otherEnum.Current))
-                    return false;
-            }
-        }
-    }
-}
+            }
+        }
+
+        public DirectoryRecord(ObjectInfo info)
+        {
+            ObjectInfo = info;
+        }
+
+
+/*
+        public IEnumerable<DirectoryInfo> GetCheckedDirectories()
+        {
+            var q = from record in this
+                    where record.IsChecked==true
+                    select record.Info;
+            return q;
+        }
+*/
+
+/*
+        public void SetSelections(StringCollection selections)
+        {
+            IsChecked=selections.Contains(Info.FullName);                
+            foreach (var children in Directories)
+            {
+                children.SetSelections(selections);
+            }
+        }
+*/
+
+
+        public IEnumerator<DirectoryRecord> GetEnumerator()
+        {
+            yield return this;
+            foreach (var children in Directories)
+                foreach (var info in children)
+                {
+                    yield return info;
+                }
+        }
+
+        IEnumerator IEnumerable.GetEnumerator()
+        {
+            return GetEnumerator();
+        }
+
+        public override int GetHashCode()
+        {
+            return ObjectInfo == null
+                       ? (Uri == null ? DisplayName.GetHashCode() : Uri.GetHashCode())
+                       : ObjectInfo.GetHashCode();
+        }
+
+        public override bool Equals(object obj)
+        {
+            if (!(obj is DirectoryRecord))
+                return false;
+            var other = (DirectoryRecord)obj;
+            if (Uri != other.Uri)
+                return false;
+            if (ObjectInfo== null ^ other.ObjectInfo== null)
+                return false;
+
+            if (ObjectInfo!= null && !ObjectInfo.Equals(other.ObjectInfo))
+                return false;
+            var thisEnum = GetEnumerator();
+            var otherEnum = other.GetEnumerator();
+            //Skipt the first item, it is the current node itself
+            thisEnum.MoveNext();
+            otherEnum.MoveNext();
+            while (true)
+            {
+                var thisMove = thisEnum.MoveNext();
+                var otherMove = otherEnum.MoveNext();
+
+                if (thisMove ^ otherMove)
+                    return false;
+                if (!thisMove)
+                    return true;
+
+                if (!thisEnum.Current.Equals(otherEnum.Current))
+                    return false;
+            }
+        }
+    }
+}
