Beispiel #1
0
        private void BindEvents(
            ToolStripMenuItem miNewWindow,
            ToolStripMenuItem miLoad,
            ToolStripMenuItem miSaveAs,
            ToolStripMenuItem miExit)
        {
            miNewWindow.Click += (s, a) =>
                                 formMgrService.CreateNewForm();

            // event handling
            miExit.Click += (s, a) =>
            {
                VgcApis.Libs.UI.RunInUiThread(
                    this.formMain,
                    () => this.formMain.Close());
            };

            miLoad.Click += (s, a) =>
            {
                if (editorCtrl.IsChanged() &&
                    !VgcApis.Libs.UI.Confirm(I18N.DiscardUnsavedChanges))
                {
                    return;
                }

                string script = VgcApis.Libs.UI.ReadFileContentFromDialog(
                    VgcApis.Models.Consts.Files.LuaExt);

                // user cancelled.
                if (script == null)
                {
                    return;
                }

                editorCtrl.SetCurrentEditorContent(script);
            };

            miSaveAs.Click += (s, a) =>
            {
                VgcApis.Libs.UI.SaveToFile(
                    VgcApis.Models.Consts.Files.LuaExt,
                    editorCtrl.GetCurrentEditorContent());
            };
        }
Beispiel #2
0
        private void BindEvents()
        {
            miNewWindow.Click += (s, a) =>
                                 formMgrService.CreateNewForm();

            // event handling
            miExit.Click += (s, a) =>
                            VgcApis.Misc.UI.CloseFormIgnoreError(formMain);

            miLoad.Click += (s, a) =>
            {
                if (editorCtrl.IsChanged() &&
                    !VgcApis.Misc.UI.Confirm(I18N.DiscardUnsavedChanges))
                {
                    return;
                }

                string script = VgcApis.Misc.UI.ReadFileContentFromDialog(
                    VgcApis.Models.Consts.Files.LuaExt);

                // user cancelled.
                if (script == null)
                {
                    return;
                }

                tabControlMain.SelectTab(1);
                editorCtrl.SetCurrentEditorContent(script);
            };

            miSaveAs.Click += (s, a) =>
            {
                VgcApis.Misc.UI.SaveToFile(
                    VgcApis.Models.Consts.Files.LuaExt,
                    editorCtrl.GetCurrentEditorContent());
            };
        }