public CommandDefinition(string cmdString, CmdAction cb, bool requireConfirm = false, bool isAdminOnly = false) { CmdString = cmdString; Callback = cb; RequireConfirm = requireConfirm; IsAdminOnly = isAdminOnly; }
public Command(CmdAction action, CmdDirection direction, IItem item = null, IUsable usable = null) { Action = action; Direction = direction; Item = item; Usable = usable; }
public static void CreateCommand(string cmd, CmdAction cb, bool requireConfirm = false, bool isAdminOnly = false) { if (!_singleton._commands.ContainsKey(cmd.ToLower())) { _singleton._commands.Add(cmd.ToLower(), new CommandDefinition(cmd.ToLower(), cb, requireConfirm, isAdminOnly)); } }
public Command(string name, string description, Plugin pl, CmdAction Do) { this.Name = name; this.Do = Do; this.Description = description; this.Plugin = pl; }
public VMLogin(WndLoginDlg wndLogin) { CommandLogin = new CmdAction(arg => ActionLoginAsync()); CommandCloseApp = new CmdCloseApp(); this.wndLogin = wndLogin ?? throw new ArgumentNullException(nameof(wndLogin), "VMLogin constructor: ArgumentNullException"); wndLogin.PassTxt.PasswordChanged += PassTxt_PasswordChanged; }
public VMWndMain() { CmdWindowLoaded = new CmdAction(arg => WindowLoadedAsync()); CmdShowWndSettings = new CmdAction(arg => ShowToolWndDlg(new WndSettings(), new VMSettings())) { CanExecuteDelegate = SettingsAvailable }; }
public bool Start() { if (IsBusy) { Log.warn("命令队列未完成,请稍后重试!"); return(false); } CmdCostTime = 0; CmdAction = CmdTask; CmdStartTime = DateTime.Now; CmdResult = CmdAction.BeginInvoke(CmdComplete, CmdAction); return(true); }
public VMChangeLoginPass(Employee item, WndChangeLoginPass wnd) { m_item = item; m_wnd = wnd; m_passwordBox = m_wnd.PassTxt; CmdClose = new CmdAction(arg => m_wnd.Close()); CmdUpdLoginPass = new CmdAction(arg => UpdateLoginPass()) { CanExecuteDelegate = CanExecuteChange }; m_passBoxSigned = true; m_passwordBox.PasswordChanged += PasswordChanged; LoginTxt = m_item.Login; }
public VMAddEmployee(WndAddEmployee wnd) { m_wnd = wnd; m_item = new Employee() { Name = "Новый сотрудник" }; CmdAdd = new CmdAction(arg => AddEmployee()) { CanExecuteDelegate = CanExecuteCmdAdd }; CmdCancel = new CmdAction(arg => m_wnd.Close()); GroupsView = new ObservableCollection <Group>(CtrlDbCtx.Instance.GroupsOfEmployee); UpdateListAvailableChiefs(); Subscribe(); }
public VMTreeEmployees() { CmdSave = new CmdSave(this); CmdCalcPayroll = new CmdAction(arg => CalcPayroll()) { CanExecuteDelegate = CanCalculatePayroll }; CmdCalcPayrollAll = new CmdAction(arg => CalcPayrollAll()) { CanExecuteDelegate = CanCalculatePayroll }; CmdChangeLoginPass = new CmdAction(arg => OpenWndChangePass()); CmdAddEmployee = new CmdAction(arg => AddEmployee()) { CanExecuteDelegate = CanChangeListEmployees }; CmdRemoveEmployee = new CmdAction(arg => RemoveEmployee()) { CanExecuteDelegate = CanChangeListEmployees }; CtrlDbCtx.Instance.OnCollectionChanged += OnCollectionChanged; }
private Command FinishedCommand(CmdAction action, CmdDirection direction, IItem item = null, IUsable usable = null) { nextStep = null; return(new Command(action, direction, item, usable)); }
public void SetMain(CmdAction action) { m_run = action; }
public void Add(string subcommand, CmdAction action) { Add(subcommand).m_run = action; }
public Chatcommand(CmdAction action) : this() { m_run = action; }
public Command(string cmdName, CmdAction argAction) { this.cmdName = cmdName.ToLower(); action = argAction; takesArgs = true; }
public Command(string cmdName, Action action) { this.cmdName = cmdName.ToLower(); this.action = (string[] args) => { action(); return(true); }; takesArgs = false; }
// Shorthand for simple subcommands public void Add(string subcommand, CmdAction action) { Add(subcommand).SetMain(action); }
public Command(string name, Plugin pl, CmdAction Do) { this.Name = name; this.Do = Do; this.Plugin = pl; }