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
        private void EventHandler_Open(object sender, System.EventArgs e)
        {
            TreeNode      node = gscriptTreeView.SelectedNode;
            frmCodeEditor codeEditor;

            if (node != null)
            {
                ScriptTreeNodeProperty prop = (ScriptTreeNodeProperty)node.Tag;
                if (prop != null)
                {
                    if (prop.Type == ScriptTreeNodeType.G ||
                        prop.Type == ScriptTreeNodeType.Simple)
                    {
                        try
                        {
                            ScriptType type = prop.Type == ScriptTreeNodeType.G ? ScriptType.G : ScriptType.Simple;
                            foreach (frmDummy form in parent__.MdiChildren)
                            {
                                if (form is frmCodeEditor)
                                {
                                    codeEditor = (form as frmCodeEditor);
                                    if (codeEditor.ScriptName.Equals(prop.Name) &&
                                        codeEditor.ScriptType.Equals(type))
                                    {
                                        codeEditor.BringToFront();
                                        return;
                                    }
                                }
                            }
                            codeEditor = new frmCodeEditor(parent__, compiler__, configReader__);
                            codeEditor.LoadExistingCode(prop.Name, type, false);
                            codeEditor.Show();
                            return;
                        }
                        catch
                        {
                        }
                    }
                    if (e == null)
                    {
                        if (prop.Type == ScriptTreeNodeType.GRoot ||
                            prop.Type == ScriptTreeNodeType.SimpleRoot)
                        {
                            if (!node.IsExpanded)
                            {
                                node.Expand();
                            }
                        }
                    }
                }
            }
        }
Exemple #3
0
        private void EventHandler_Open(object sender, System.EventArgs e)
        {
            TreeNode node = gscriptTreeView.SelectedNode;
            frmCodeEditor codeEditor;
            if (node != null)
            {
                ScriptTreeNodeProperty prop = (ScriptTreeNodeProperty)node.Tag;
                if (prop != null)
                {
                    if (prop.Type == ScriptTreeNodeType.G ||
                        prop.Type == ScriptTreeNodeType.Simple)
                    {
                        try
                        {
                            ScriptType type = prop.Type == ScriptTreeNodeType.G ? ScriptType.G : ScriptType.Simple;
                            foreach (frmDummy form in parent__.MdiChildren)
                            {
                                if (form is frmCodeEditor)
                                {
                                    codeEditor = (form as frmCodeEditor);
                                    if (codeEditor.ScriptName.Equals(prop.Name) &&
                                        codeEditor.ScriptType.Equals(type))
                                    {
                                        codeEditor.BringToFront();
                                        return;
                                    }
                                }
                            }
                            codeEditor = new frmCodeEditor(parent__, compiler__, configReader__);
                            codeEditor.LoadExistingCode(prop.Name, type, false);
                            codeEditor.Show();
                            return;
                        }
                        catch
                        {

                        }
                    }
                    if (e == null)
                    {
                        if (prop.Type == ScriptTreeNodeType.GRoot ||
                            prop.Type == ScriptTreeNodeType.SimpleRoot)
                        {
                            if (!node.IsExpanded)
                            {
                                node.Expand();
                            }
                        }
                    }
                }
            }
        }
Exemple #4
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
            {
            }
        }