public string ScriptContent(RuntimeScript script, KeyObject obj) { var ac = AppCommands.ToAppCommnad(script?.Data); var r = AppCommands.GetResource(); return(string.Format(AppCommands.AppCommandContextLocalizing(r), ac.HasValue ? AppCommands.APPCOMMANDToString(ac.Value, r) : "unknown")); }
private void InitializeComboBox() { _appCommands = AppCommands.GetAppCommands(); for (int i = 0; i < _appCommands.Length; i++) { commandComboBox.Items.Add(_appCommands[i].Text); } commandComboBox.SelectedIndex = 0; SelectedCommand = _appCommands.TryGetValue(0); commandComboBox.SelectedIndexChanged += CommandComboBox_SelectedIndexChanged; }
public void Run(ScriptInfo scriptInfo, RuntimeScript script, bool isDown) { if (isDown) { switch (script.RuntimeName) { case "Plugin.AppCommand": var command = AppCommands.ToAppCommnad(script.Data); if (command.HasValue) { AppCommandAPI.Send(command.Value); } break; default: return; } } }
private void Menu_Click(object sender, EventArgs e) { if (_scriptEditor == null || !((sender as ToolStripMenuItem).Tag is string t)) { return; } switch (t) { case "edit": if (_runtimeScript == null) { break; } var rcs = AppCommands.ToAppCommnad(_runtimeScript?.Data); using (var acr = new AppCommandDialog(rcs ?? APPCOMMAND.APPCOMMAND_SAVE)) if (acr.ShowDialog() == DialogResult.OK && acr.SelectedCommand != null) { _runtimeScript.Data = acr.SelectedCommand.GetData(); } _scriptEditor.RefreshView(); break; case "add": if (_keyObject == null) { break; } using (var acr = new AppCommandDialog()) if (acr.ShowDialog() == DialogResult.OK && acr.SelectedCommand != null) { _keyObject.Scripts.AddRuntimeScript(new RuntimeScript { RuntimeName = AppCommandRuntime.AppCommandRuntimeName, Data = acr.SelectedCommand.GetData() }); _scriptEditor.RefreshView(); } break; } }