Exemple #1
0
        private void EventHandler_New(object sender, System.EventArgs e)
        {
            try
            {
                TreeNode node = gscriptTreeView.SelectedNode;
                if (node != null)
                {
                    ScriptTreeNodeProperty prop = (ScriptTreeNodeProperty)node.Tag;
                    if (prop != null)
                    {
                        ScriptType type;
                        if (prop.Type == ScriptTreeNodeType.G ||
                            prop.Type == ScriptTreeNodeType.GRoot)
                        {
                            type = ScriptType.G;
                        }
                        else
                        {
                            type = ScriptType.Simple;
                        }

                        string name = StringInputBox.GetInputString(Resources.TEXT_INPUTNAME,
                                                                    Resources.TEXT_INPUTNAME_TITLE,
                                                                    SunnyChen.Common.RegularExpressions.RegularExpressionSet.IDENTIFIER);

                        if (name.Trim().Equals(string.Empty))
                        {
                            return;
                        }
                        string fileName = FileSystemScriptRepository.GetScriptFileName(name, type);
                        if (File.Exists(fileName))
                        {
                            MessageBox.Show(Resources.TEXT_SCRIPT_ALREADY_EXISTS,
                                            Resources.TEXT_ERROR,
                                            MessageBoxButtons.OK,
                                            MessageBoxIcon.Error);

                            return;
                        }
                        frmCodeEditor codeEditor = new frmCodeEditor(parent__, compiler__, configReader__);
                        codeEditor.CreateNewCode(name, fileName, type);
                        codeEditor.Show();
                        toolbarsManager.Tools["mnuDelete"].SharedProps.Enabled  = false;
                        toolbarsManager.Tools["mnuRun"].SharedProps.Enabled     = false;
                        toolbarsManager.Tools["mnuCompile"].SharedProps.Enabled = false;
                    }
                }
            }
            catch
            {
            }
        }
Exemple #2
0
        /// <summary>
        /// Initializes the Gulu.
        /// </summary>
        /// <returns>True if succeed. False if it failed, in this case the
        /// operation will be canceled.</returns>
        public override bool Init()
        {
            string ok = StringInputBox.GetInputString(
                Resources.TEXT_INPUT_OK_TEXT,
                Resources.TEXT_INPUT_OK_TITLE,
                CharacterCasing.Upper);

            if (ok.Trim().ToUpper().Equals("OK"))
            {
                return(true);
            }
            return(false);
        }