private UICommand(CommandExecuteDelegate actionExecute, CommandCanExecuteDelegate actionCanExecute = null, bool startInThread = false) { mActionExecute = actionExecute; mActionCanExecute = actionCanExecute; mStartInThread = startInThread; }
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; }
public static UICommand Regular(CommandExecuteDelegate actionExecute, CommandCanExecuteDelegate actionCanExecute = null) { return new UICommand(actionExecute, actionCanExecute, false); }
/// <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; }
/// <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; }
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); }
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); }