コード例 #1
0
ファイル: UICommand.cs プロジェクト: PictoCrypt/ImageTools
 private UICommand(CommandExecuteDelegate actionExecute, CommandCanExecuteDelegate actionCanExecute = null,
     bool startInThread = false)
 {
     mActionExecute = actionExecute;
     mActionCanExecute = actionCanExecute;
     mStartInThread = startInThread;
 }
コード例 #2
0
ファイル: CommandsManager.cs プロジェクト: Nuriat/radegast
        public IRadegastCommand AddCmd(string name, string desc, string usage, CommandExecuteDelegate executeDelegate)
        {
            IRadegastCommand cmd = new RadegastCommand(instance, executeDelegate)
                                       {
                                           Name = name,
                                           Description = name,
                                           Usage = usage
                                       };

            LoadCommand(cmd);
            return cmd;
        }
コード例 #3
0
ファイル: UICommand.cs プロジェクト: PictoCrypt/ImageTools
 public static UICommand Regular(CommandExecuteDelegate actionExecute,
     CommandCanExecuteDelegate actionCanExecute = null)
 {
     return new UICommand(actionExecute, actionCanExecute, false);
 }
コード例 #4
0
ファイル: RadegastCommand.cs プロジェクト: Booser/radegast
 /// <summary>
 /// For simple creation of new commands
 /// </summary>
 /// <param name="inst"></param>
 /// <param name="exec"></param>
 public RadegastCommand(RadegastInstance inst, CommandExecuteDelegate exec)
 {
     _instance = inst;
     _execute = exec;
 }
コード例 #5
0
ファイル: RadegastCommand.cs プロジェクト: Booser/radegast
 /// <summary>
 /// for subclasses (they should override Execute)
 /// </summary>
 /// <param name="name"></param>
 /// <summary>
 /// For simple creation of new commands
 /// </summary>
 /// <param name="inst"></param>
 public RadegastCommand(RadegastInstance inst)
 {
     _instance = inst;
     _execute = null;
 }
コード例 #6
0
        internal int RegisterCommandInternal(string command, string description, FCVar flags, CommandExecuteDelegate callback)
        {
            ManagedCommand cmd = this.CreateCommand(command, description, flags, callback);

            byte[] cmdUTF8  = this.m_enc.GetBytes(command);
            byte[] descUTF8 = this.m_enc.GetBytes(description);
            int    iFlags   = (int)flags;

            int id = this.RegisterCommandImpl(cmdUTF8, descUTF8, iFlags, cmd.Id);

            if (id == -1)
            {
                this.UnregisterCommandDic(id);
            }
            return(id);
        }
コード例 #7
0
        protected ManagedCommand CreateCommand(string name, string description, FCVar flags, CommandExecuteDelegate callback)
        {
            int            id  = Interlocked.Increment(ref s_commandId);
            ManagedCommand cmd = new ManagedCommand
            {
                Id          = id,
                Name        = name,
                Description = description,
                Flags       = flags,
                Callback    = callback,
            };

            lock (this.m_commands)
            {
                this.m_commands.Add(cmd.Id, cmd);
            }
            return(cmd);
        }