/// <summary> /// Unlocks the lockable items in the locking context</summary> ///<param name="items">Items to unlock</param> ///<param name="lockingContext">Locking context</param> public void Unlock( IEnumerable<object> items, ILockingContext lockingContext) { foreach (object item in items) if (lockingContext.CanSetLocked(item) && lockingContext.IsLocked(item)) lockingContext.SetLocked(item, false); }
/// <summary> /// Checks if the client can do the command</summary> /// <param name="commandTag">Command</param> /// <returns>True if client can do the command</returns> bool ICommandClient.CanDoCommand(object commandTag) { bool canDo = false; if (commandTag is StandardCommand) { ISelectionContext selectionContext = m_contextRegistry.GetActiveContext <ISelectionContext>(); ILockingContext lockingContext = m_contextRegistry.GetActiveContext <ILockingContext>(); if (selectionContext != null && lockingContext != null) { switch ((StandardCommand)commandTag) { case StandardCommand.EditLock: foreach (object item in selectionContext.Selection) { if (lockingContext.CanSetLocked(item) && !lockingContext.IsLocked(item)) { canDo = true; break; } } break; case StandardCommand.EditUnlock: foreach (object item in selectionContext.Selection) { if (lockingContext.CanSetLocked(item) && lockingContext.IsLocked(item)) { canDo = true; break; } } break; } } } return(canDo); }
/// <summary> /// Unlocks the lockable items in the locking context</summary> ///<param name="items">Items to unlock</param> ///<param name="lockingContext">Locking context</param> public void Unlock( IEnumerable <object> items, ILockingContext lockingContext) { foreach (object item in items) { if (lockingContext.CanSetLocked(item) && lockingContext.IsLocked(item)) { lockingContext.SetLocked(item, false); } } }