private void BindEvents() { cboxFunctionList.DropDownClosed += (s, a) => VgcApis.Misc.UI.Invoke(() => { var kw = cboxFunctionList.Text; if (string.IsNullOrWhiteSpace(kw)) { return; } ScrollToText(kw); }); cboxFunctionList.DropDown += (s, a) => { var content = luaEditor.Text; var list = ExtractFunctionsFrom(content); VgcApis.Misc.UI.Invoke(() => { var items = cboxFunctionList.Items; items.Clear(); items.AddRange(list); VgcApis.Misc.UI.ResetComboBoxDropdownMenuWidth(cboxFunctionList); }); }; luaEditor.InsertCheck += Scintilla_InsertCheck; luaEditor.CharAdded += Scintilla_CharAdded; luaEditor.TextChanged += Scintilla_TextChanged; btnNewScript.Click += (s, a) => ClearEditor(); btnKillScript.Click += (s, a) => luaCoreCtrl.Abort(); btnStopScript.Click += (s, a) => luaCoreCtrl.Stop(); btnRunScript.Click += (s, a) => { formMain.SetOutputPanelCollapseState(false); var name = cboxScriptName.Text; luaCoreCtrl.Abort(); luaCoreCtrl.SetScriptName(string.IsNullOrEmpty(name) ? $"({I18N.Empty})" : name); luaCoreCtrl.ReplaceScript(luaEditor.Text); luaCoreCtrl.Start(); }; btnClearOutput.Click += (s, a) => { qLogger?.Reset(); }; btnSaveScript.Click += (s, a) => OnBtnSaveScriptClickHandler(true); cboxScriptName.DropDown += (s, a) => ReloadScriptName(); cboxScriptName.SelectedValueChanged += CboxScriptNameChangedHandler; }
private void BindEvents() { luaEditor.InsertCheck += Scintilla_InsertCheck; luaEditor.CharAdded += Scintilla_CharAdded; luaEditor.TextChanged += Scintilla_TextChanged; btnNewScript.Click += (s, a) => ClearEditor(); btnKillScript.Click += (s, a) => luaCoreCtrl.Kill(); btnStopScript.Click += (s, a) => luaCoreCtrl.Stop(); btnRunScript.Click += (s, a) => { var name = cboxScriptName.Text; luaCoreCtrl.Kill(); luaCoreCtrl.SetScriptName( string.IsNullOrEmpty(name) ? $"({I18N.Empty})" : name); luaCoreCtrl.ReplaceScript(luaEditor.Text); luaCoreCtrl.Start(); }; btnClearOutput.Click += (s, a) => { qLogger?.Reset(); }; btnDeleteScript.Click += (s, a) => { var scriptName = cboxScriptName.Text; if (string.IsNullOrEmpty(scriptName) || !VgcApis.Libs.UI.Confirm(I18N.ConfirmRemoveScript)) { return; } if (!luaServer.RemoveScriptByName(scriptName)) { VgcApis.Libs.UI.MsgBoxAsync("", I18N.ScriptNotFound); } }; btnSaveScript.Click += (s, a) => OnBtnSaveScriptClickHandler(true); cboxScriptName.DropDown += (s, a) => ReloadScriptName(); cboxScriptName.SelectedValueChanged += CboxScriptNameChangedHandler; }