コード例 #1
0
ファイル: AlfredModule.cs プロジェクト: IntegerMan/Alfred
 /// <summary>
 /// Processes an Alfred Command. If the command is handled, result should be modified accordingly and the method should return true. Returning false will not stop the message from being propogated.
 /// </summary>
 /// <param name="command">The command.</param>
 /// <param name="result">The result. If the command was handled, this should be updated.</param>
 /// <returns><c>True</c> if the command was handled; otherwise false.</returns>
 public virtual bool ProcessAlfredCommand(ChatCommand command, AlfredCommandResult result)
 {
     return false;
 }
コード例 #2
0
        /// <summary>
        ///     Processes an Alfred Command. If the command is handled, result should be modified accordingly
        ///     and the method should return true. Returning false will not stop the message from being
        ///     propagated.
        /// </summary>
        /// <param name="command">The command.</param>
        /// <param name="result">The result. If the command was handled, this should be updated.</param>
        /// <returns><c>True</c> if the command was handled; otherwise false.</returns>
        public override bool ProcessAlfredCommand(ChatCommand command, AlfredCommandResult result)
        {
            if (command.Name.Matches("Shutdown"))
            {
                ExecuteShutdownCommand();
                return true;
            }

            return base.ProcessAlfredCommand(command, result);
        }
コード例 #3
0
        /// <summary>
        ///     Processes an Alfred Command. If the <paramref name="command"/> is handled,
        ///     <paramref name="result"/> should be modified accordingly and the method should
        ///     return true. Returning <see langword="false"/> will not stop the message from being
        ///     propagated.
        /// </summary>
        /// <param name="command"> The command. </param>
        /// <param name="result">
        ///     The result. If the <paramref name="command"/> was handled, this should be updated.
        /// </param>
        /// <returns>
        ///     <c>True</c> if the <paramref name="command"/> was handled; otherwise false.
        /// </returns>
        public override bool ProcessAlfredCommand(ChatCommand command, AlfredCommandResult result)
        {
            foreach (var module in Modules)
            {
                if (module.ProcessAlfredCommand(command, result))
                {
                    return true;
                }
            }

            return base.ProcessAlfredCommand(command, result);
        }