public CommandDefinition(string cmdString, CmdAction cb, bool requireConfirm = false, bool isAdminOnly = false)
 {
     CmdString      = cmdString;
     Callback       = cb;
     RequireConfirm = requireConfirm;
     IsAdminOnly    = isAdminOnly;
 }
Exemple #2
0
 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));
     }
 }
Exemple #4
0
 public Command(string name, string description, Plugin pl, CmdAction Do)
 {
     this.Name        = name;
     this.Do          = Do;
     this.Description = description;
     this.Plugin      = pl;
 }
Exemple #5
0
        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;
        }
Exemple #6
0
 public VMWndMain()
 {
     CmdWindowLoaded    = new CmdAction(arg => WindowLoadedAsync());
     CmdShowWndSettings = new CmdAction(arg => ShowToolWndDlg(new WndSettings(), new VMSettings()))
     {
         CanExecuteDelegate = SettingsAvailable
     };
 }
Exemple #7
0
 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;
 }
Exemple #9
0
 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();
 }
Exemple #10
0
 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));
 }
Exemple #12
0
 public void SetMain(CmdAction action)
 {
     m_run = action;
 }
Exemple #13
0
 public void Add(string subcommand, CmdAction action)
 {
     Add(subcommand).m_run = action;
 }
Exemple #14
0
 public Chatcommand(CmdAction action) : this()
 {
     m_run = action;
 }
Exemple #15
0
 public Command(string cmdName, CmdAction argAction)
 {
     this.cmdName = cmdName.ToLower();
     action       = argAction;
     takesArgs    = true;
 }
Exemple #16
0
 public Command(string cmdName, Action action)
 {
     this.cmdName = cmdName.ToLower();
     this.action  = (string[] args) => { action(); return(true); };
     takesArgs    = false;
 }
Exemple #17
0
 // Shorthand for simple subcommands
 public void Add(string subcommand, CmdAction action)
 {
     Add(subcommand).SetMain(action);
 }
Exemple #18
0
 public Command(string name, Plugin pl, CmdAction Do)
 {
     this.Name   = name;
     this.Do     = Do;
     this.Plugin = pl;
 }