Пример #1
0
        private void newClicked(object sender, EventArgs e)
        {
            string name = ((ToolStripMenuItem)(sender)).Name;

            switch (name)
            {
            case "scriptNewMenu":
                ScriptCreateDialog scd = new ScriptCreateDialog();
                var dlg1 = scd.ShowDialog();
                switch (dlg1)
                {
                case DialogResult.OK:
                    welcomePanel.Visible = false;
                    editorPanel.Visible  = true;
                    saveBtn.Enabled      = true;
                    progress.Visible     = true;
                    Creator.Create(Creator.CreationType.Script, ScriptCreationData.Directory, ScriptCreationData.Name);
                    break;

                case DialogResult.Cancel:
                    welcomePanel.Visible = true;
                    editorPanel.Visible  = false;
                    saveBtn.Enabled      = false;
                    break;
                }
                break;

            case "projNewMenu":
                ProjectCreateDialog pcd = new ProjectCreateDialog();
                var dlg = pcd.ShowDialog();
                switch (dlg)
                {
                case DialogResult.OK:
                    welcomePanel.Visible = false;
                    editorPanel.Visible  = true;
                    UnlockAll();
                    progress.Visible = true;
                    _isProject       = true;
                    Creator.Create(ProjectCreationData.ProjCreationType, ProjectCreationData.ProjectDir, ProjectCreationData.ProjectName);
                    break;

                case DialogResult.Cancel:
                    break;
                }
                break;
            }
        }
Пример #2
0
        /// <summary>
        /// Emitted when the user clicks the OK button.
        /// </summary>
        /// <param name="dialog">This dialog</param>
        /// <param name="action">action ( Script script )</param>
        /// <returns>Unsubscribe callback</returns>
        public static VoidFunc OnScriptCreated(this ScriptCreateDialog dialog, Action <Script> action)
        {
            var callback = dialog.Subscribe(ScriptCreatedSignal, action);

            return(() => dialog.Unsubscribe(ScriptCreatedSignal, callback));
        }