/// <summary> /// Create a command, including handler function and documentation /// </summary> /// <param name="handler">Function implementing command</param> /// <param name="args">List of arguments, not including command name; e.g., "new string[] { "readmembytes", "bank", "addr", len [filt]"</param> /// <param name="doc">Descriptive documentation.</param> public Command(string name, CommandFunc handler, string[] args, string doc) { Handler = handler; Name = name; Args = (null != args) ? args : new string[] { }; Doc = doc; }
public IList <t_AlarmTable_en> GetAlarm_enInf(int minAlarmstate, DateTime?AlarmDateTimeBegin, DateTime?AlarmDateTimeEnd, IList <OrderByCondtion> orderByColumns) { string timeCondBegin = ""; string timeCondEnd = ""; string stateCond = ""; List <string> orderbyCond = new List <string>(); stateCond = " AlarmState >=" + minAlarmstate; string sql = "SELECT AlarmID,ALarmType,AlarmState,Company,AlarmDateTime,PID,DID,CID,AlarmCate,AlarmValue FROM t_AlarmTable_en WHERE " + stateCond; if (null != AlarmDateTimeBegin) { timeCondBegin += " AlarmDateTime>='" + AlarmDateTimeBegin + "' "; sql += " and " + timeCondBegin; } if (null != AlarmDateTimeEnd) { timeCondEnd += " AlarmDateTime<='" + AlarmDateTimeEnd + "' "; sql += " and " + timeCondEnd; } foreach (var v in orderByColumns) { orderbyCond.Add(v.ColumnName + " " + CommandFunc.ConvertToString(v.orderType)); } if (orderbyCond.Count() > 0) { sql += " order by " + String.Join(",", orderbyCond); } return(SQLQuery <t_AlarmTable_en>(sql)); }
/// <summary> /// Adds a command to the game. /// </summary> /// <returns>The full mod command id if added to the game, <c>null</c> otherwise</returns> /// <param name="key">The key used to run the command.</param> /// <param name="function">The function run when command is input.</param> /// <param name="description">A description to input when help is command is run (if not null).</param> /// <param name="autoComplete">If set to <c>true</c> then autocomplete for command is enabled.</param> public static string RegisterCommand(string key, CommandFunc function, string description = null, bool autoComplete = false) { if (Pathfinder.CurrentMod == null && !Extension.Handler.CanRegister) { throw new InvalidOperationException("RegisterCommand can not be called outside of mod or extension loading."); } var id = Pathfinder.CurrentMod?.GetCleanId() ?? Extension.Handler.ActiveInfo.Id; Logger.Verbose("{0} {1} is attempting to add command {2}", Pathfinder.CurrentMod != null ? "Mod" : "Extension", id, key); if (ModCommands.ContainsKey(key)) { return(null); } ModCommands.Add(key, function); if (!ModIdToCommandKeyList.ContainsKey(id)) { ModIdToCommandKeyList.Add(id, new List <string>()); } ModIdToCommandKeyList[id].Add(key); if (description != null) { //Helpfile.help.Add(key + "\n " + description); Help.help.Add(key, description); } if (autoComplete && !ProgramList.programs.Contains(key)) { ProgramList.programs.Add(key); } return(id + '.' + key); }
public override async Task Init() { //await UnhandledExceptionProccesing.SendErrorServer(); if (OrderRowId == default(Guid)) { OrderRowId = new Guid("4CB06476-B10C-406A-98A2-7A6693A4E590"); } HeaderTitle = Globalization.T("(!)OrderDetails"); AllPatientTabs.ForEach(q => PatientHeaderModels.Add(q, new PatientHeaderModel())); PatientAddCommand = CommandFunc.CreateAsync(PatientAdd); PatientDeleteCommand = CommandFunc.CreateAsync(PatientDelete, () => SelectedPatientOrderItem != null); CommitCommand = CommandFunc.CreateAsync(Commit, () => !HasPatientOrderItemError()); CancelCommand = CommandFunc.CreateAsync(Cancel); NavigationBarButton1Command = CommandFunc.CreateAsync(ProfileViewModel.OpenPage); PatientItemTapCommand = new Command <ItemTapCommandContext>(async(q) => await PatientItemTap(q)); ScheduleItemSlotTapCommand = new Command <ItemTapCommandContext>(ScheduleItemSlotTap); //this.PropertyChanged += PropertyChangedAction; U.RequestMainThread(async() => { if (!await LoadData()) { return; } CalendarManager.Control.SelectionChanged += (s, e) => CalcCurrentScheduleItemSlots(); //SelectedPatientOrderItem = PatientOrderItems.FirstOrDefault(); CalcAll(); }); }
public Command(string name, CommandFunc fnc, string helpText, int argCount) { CommandName = name; CommandFunction = fnc; HelpText = helpText; ArgCount = argCount; }
public Command(string name, string parameters, byte authority, CommandFunc func) { this.Name = name; this.Parameters = parameters; this.Auth = authority; this.Func = func; }
public Command(CommandFunc f, string a, string usage, bool loggedIn) { command = f; args = a; this.usage = usage; this.loggedIn = loggedIn; }
public ConsoleCommand(string commandName, CommandFunc function, bool autoCompleteEnabled = true, string commandHelp = null) { CommandName = commandName; Function = function; AutoCompleteEnabled = autoCompleteEnabled; CommandHelp = commandHelp; }
/// <summary> /// Create a command, including handler function and documentation /// </summary> /// <param name="handler">Function implementing command</param> /// <param name="usage">Space-separated list of arguments, including command name; e.g., "readmembytes bank addr len [filt]"</param> /// <param name="docLines">Descriptive documentation. Arbitrary number of args may be provided, with each becoming a separate line in the final doc. First line should be a one-line summary.</param> public Command(CommandFunc handler, string usage, params string[] docLines) : this("", handler, null, null) { string[] argv = Split(usage); Name = argv[0]; Args = new string[argv.Length-1]; Array.Copy(argv, 1, Args, 0, Args.Length); Doc = JoinLines(docLines); }
/// <summary> /// メソッドを追加する /// </summary> /// <param name="key">コマンドキー</param> /// <param name="method">アクション関数</param> public void AddListener(string key, CommandFunc method, string explain) { if (key[0] != '!') { Console.WriteLine("[AddListener] keyの先頭が ! ではありません。"); return; } action_method[key] = method; Command._commandDict.Add(key, explain); }
public void Add(string commandMatch, CommandFunc commandFunc) { commandMatch = commandMatch.ToLower(); if (_commandStore.ContainsKey(commandMatch)) { _commandStore[commandMatch] += commandFunc; } else { _commandStore[commandMatch] = commandFunc; } }
public override async Task Init() { //UserProfileRowId = new Guid("881C381C-2EEF-420B-9398-39B5190E9CEC"); UserProfileRowId = UserOptions.GetUserProfileRowId(); HeaderTitle = Globalization.T("Orders"); IsBackVisible = U.IsBackVisible; ItemTapCommand = new Command <ItemTapCommandContext>(ItemTap); NavigationBarButton1Command = CommandFunc.CreateAsync(ProfileViewModel.OpenPage); U.RequestMainThread(async() => { if (!await LoadData()) { return; } CalcAll(); }); }
public override async Task Init() { HeaderTitle = Globalization.T("ChangePassword"); IsBackVisible = U.IsBackVisible; AllPatientTabs.ForEach(q => PatientHeaderModels.Add(q, new PatientHeaderModel())); CommitCommand = CommandFunc.CreateAsync(Commit, () => !HasModelErrors()); CancelCommand = CommandFunc.CreateAsync(Cancel); LocaleChooseCommand = CommandFunc.CreateAsync(async() => await Globalization.SwitchLocale()); U.RequestMainThread(async() => { if (!await LoadData()) { return; } CalcAll(); }); }
public Command RegisterCommand(string name, CommandFunc func) { if (name == null) { throw new ArgumentNullException("name"); } if (func == null) { throw new ArgumentNullException("func"); } var c = new ServerCommand { Id = id++, Name = name, Function = func, }; commands.Add(c); SendCommand(c); return(c); }
public override async Task Init() { //UserProfileRowId = new Guid("2fd3c1cb-be1a-4444-8131-c44447d3b6bc"); HeaderTitle = Globalization.T("Profile"); IsBackVisible = U.IsBackVisible; AllPatientTabs.ForEach(q => PatientHeaderModels.Add(q, new PatientHeaderModel())); CommitCommand = CommandFunc.CreateAsync(Commit, () => !HasModelErrors()); CancelCommand = CommandFunc.CreateAsync(Cancel); LogoutCommand = CommandFunc.CreateAsync(Logout); ChangePasswordCommand = CommandFunc.CreateAsync(ChangePassword); LocaleChooseCommand = CommandFunc.CreateAsync(async() => await Globalization.SwitchLocale()); U.RequestMainThread(async() => { if (!await LoadData()) { return; } CalcAll(); }); }
public static void Add(string cmdName, CommandFunc func, string args, string usage, bool loggedIn = true) { commands.Add(cmdName, new Command(func, args, usage, loggedIn)); }
public Command RegisterCommand (string name, CommandFunc func) { if (name == null) throw new ArgumentNullException ("name"); if (func == null) throw new ArgumentNullException ("func"); var c = new ServerCommand { Id = id++, Name = name, Function = func, }; commands.Add (c); SendCommand (c); return c; }
public void AddCommand(string name, string parameters, byte authority, CommandFunc func) { this.AddCommand(new Command(name, parameters, authority, func)); }
public void AddCommand(string name, byte authority, CommandFunc func) { this.AddCommand(name, null, authority, func); }
public void RegisterCommand(string name, CommandFunc func) { _Commands.Add(name, func); }
static void AddCommand(string name, CommandFunc handler) { CommandDispatchTable.Add(name, new Command(name, handler)); }
/// <summary> /// Create a command, including handler function and documentation /// </summary> /// <param name="name">Name used to invoke command</param> /// <param name="handler">Function implementing command</param> public Command(string name, CommandFunc handler) : this(name, handler, null, "") { }