/// <summary>
 /// Gets if the specified command or its module is locked.
 /// </summary>
 /// <param name="command">The command to check.</param>
 /// <param name="lockContext">The lockable context to work with.</param>
 /// <returns>True if the command or its module is locked.</returns>
 public static bool IsLocked(this CommandDetails command, IDbLockableContext lockContext)
 {
     if (lockContext == null)
     {
         return(command.IsLockedByDefault || command.Module.IsLockedByDefault);
     }
     return(command.IsCommandLocked(lockContext) || command.Module.IsModuleLocked(lockContext));
 }
Esempio n. 2
0
 /// <summary>
 /// Formats a command to show the locked or not locked symbol when it is locked.
 /// </summary>
 private string FormatCommandLocked(IDbLockableContext lockContext, CommandDetails command)
 {
     return(command.IsCommandLocked(lockContext) ? Locked : NotLocked);
 }
        /// <summary>
        /// Gets if the specified command is locked.
        /// </summary>
        /// <param name="locking">The locking service to work with.</param>
        /// <param name="context">The command context to look for.</param>
        /// <param name="command">The command to check.</param>
        /// <returns>True if the command is locked.</returns>
        public static async Task <bool> IsCommandLockedAsync(this IContextingService locking, ICommandContext context, CommandDetails command)
        {
            IDbLockableContext lockContext = await locking.FindDbLockableContextAsync(context).ConfigureAwait(false);

            return(command.IsCommandLocked(lockContext));
        }