Beispiel #1
0
 private void checkLockModifyChangeAction(HashSetChangeAction hashSetChangeAction)
 {
     if (lockModifyChangeActionsKeys.ContainsKey(hashSetChangeAction))
     {
         throw new ObservableComputationsException(this,
                                                   "Modifying of '{hashSetChangeAction.ToString()}' change action is locked. Unlock first.");
     }
 }
Beispiel #2
0
        public void LockModifyChangeAction(HashSetChangeAction hashSetChangeAction, object key)
        {
            if (key == null)
            {
                throw new ArgumentNullException("key");
            }

            if (!lockModifyChangeActionsKeys.ContainsKey(hashSetChangeAction))
            {
                lockModifyChangeActionsKeys[hashSetChangeAction] = key;
            }
            else
            {
                throw new ObservableComputationsException(this,
                                                          $"Modifying of '{hashSetChangeAction.ToString()}' change action is already locked. Unlock first.");
            }
        }
Beispiel #3
0
        public void UnlockModifyChangeAction(HashSetChangeAction hashSetChangeAction, object key)
        {
            if (key == null)
            {
                throw new ArgumentNullException("key");
            }

            if (!lockModifyChangeActionsKeys.ContainsKey(hashSetChangeAction))
            {
                throw new ObservableComputationsException(this,
                                                          "Modifying of '{hashSetChangeAction.ToString()}' change action is not locked. Lock first.");
            }

            if (ReferenceEquals(lockModifyChangeActionsKeys[hashSetChangeAction], key))
            {
                lockModifyChangeActionsKeys.Remove(hashSetChangeAction);
            }
            else
            {
                throw new ObservableComputationsException(this,
                                                          "Wrong key to unlock modifying of '{hashSetChangeAction.ToString()}' change action.");
            }
        }
Beispiel #4
0
 public bool IsModifyChangeActionLocked(HashSetChangeAction hashSetChangeAction)
 {
     return(lockModifyChangeActionsKeys.ContainsKey(hashSetChangeAction));
 }