コード例 #1
0
 /// <summary>
 /// Checks if the command should to be enabled or not. Check
 /// our supported features list.
 /// </summary>
 /// <param name="arg">widget info</param>
 protected void checkCommandEnabled(String[] supportedCommands, CommandEnabledArg arg)
 {
     if (supportedCommands.Contains(arg.Command))
     {
         arg.Handled = true;
         arg.Enabled = true;
     }
 }
コード例 #2
0
 /// <summary>
 /// Invoked to check if a command  should be enabled or not.  This depends
 /// on the context and the agent can decide whether the command should
 /// be enabled or not.  The widget's subclass field contains the context
 /// and should be used as the clue to set the widget state.  For instance
 /// if the talk window is already empty, disable the "Clear" button
 /// </summary>
 /// <returns>true to enable, false to disable</returns>
 public virtual void CheckCommandEnabled(CommandEnabledArg arg)
 {
     if (_supportedCommands.Contains(arg.Command))
     {
         arg.Handled = true;
         arg.Enabled = true;
     }
 }
コード例 #3
0
        /// <summary>
        /// Checks if the command should be enabled depending on the
        /// current context
        /// </summary>
        /// <param name="arg">contains info about the widget</param>
        public override void CheckCommandEnabled(CommandEnabledArg arg)
        {
            switch (arg.Command)
            {
            case "CmdContextMenu":
                arg.Enabled = false;
                arg.Handled = true;
                break;

            default:
                arg.Handled = false;
                break;
            }
        }