Exemplo n.º 1
0
 public void CheckStateChangedArgs_Ctor_CheckAllFieldsAreSet_ExpectSuccess()
 {
     //------------Setup for test--------------------------
     var guid = Guid.NewGuid();
     var checkStateChangedArgs = new CheckStateChangedArgs(true, false, guid, ResourceType.Message, false);
     Assert.IsTrue(checkStateChangedArgs.PreviousState);
     Assert.IsFalse(checkStateChangedArgs.NewState);
     Assert.AreEqual(checkStateChangedArgs.ResourceId, guid);
     Assert.AreEqual(ResourceType.Message, checkStateChangedArgs.ResourceType);
     Assert.IsFalse(checkStateChangedArgs.UpdateStats);
 }
Exemplo n.º 2
0
        /// <summary>
        ///     Sets the IsChecked Property and updates children and parent
        /// </summary>
        /// <param name="value">The value.</param>
        /// <param name="updateChildren">
        ///     if set to <c>true</c> [update children].
        /// </param>
        /// <param name="updateParent">
        ///     if set to <c>true</c> [update parent].
        /// </param>
        /// <param name="calcStats"></param>
        /// <author>Jurie.smit</author>
        /// <date>2013/01/23</date>
        public void SetIsChecked(bool? value, bool updateChildren, bool updateParent, bool calcStats=true)
        {
            var preState = _isChecked;
            if(value == _isChecked)
            {
                return;
            }

            if(_isChecked == true && value == false)
            {
                if(Parent != null)
                {
                    Parent.IsOverwrite = false;
                }
                IsOverwrite = false;
            }

            _isChecked = value;

            UpdateChildren(updateChildren);

            // ReSharper disable ExplicitCallerInfoArgument
            OnPropertyChanged("IsChecked");
            // ReSharper restore ExplicitCallerInfoArgument
            CheckStateChangedArgs checkStateChangedArgs = new CheckStateChangedArgs(preState.GetValueOrDefault(false), value.GetValueOrDefault(false), ResourceId, ResourceType, (ResourceType == ResourceType.Folder || ResourceType == ResourceType.Server || (ResourcePath==null|| (!ResourcePath.Contains("\\"))))&&calcStats );
            if(OnCheckedStateChangedAction != null)
            {
                OnCheckedStateChangedAction.Invoke(checkStateChangedArgs);
            }
            UpdateParent(updateParent);
        }