public override IMyGenDocument Open(IMyGenerationMDI mdi, FileInfo file, params string[] args)
        {
            TemplateEditor edit = null;

            if (file.Exists)
            {
                bool isopen = mdi.IsDocumentOpen(file.FullName);

                if (!isopen)
                {
                    edit = new TemplateEditor(mdi);
                    edit.FileOpen(file.FullName);
                }
                else
                {
                    edit = mdi.FindDocument(file.FullName) as TemplateEditor;
                    if (edit != null)
                    {
                        edit.Activate();
                    }
                }
            }

            return edit;
        }
        public override IMyGenDocument Create(IMyGenerationMDI mdi, params string[] args)
        {
            TemplateEditor edit = new TemplateEditor(mdi);

            switch (args[0])
            {
                case TemplateEditorManager.CSHARP_TEMPLATE:
                    edit.FileNew("ENGINE", ZeusConstants.Engines.DOT_NET_SCRIPT, "LANGUAGE", ZeusConstants.Languages.CSHARP);
                    break;
                case TemplateEditorManager.VBNET_TEMPLATE:
                    edit.FileNew("ENGINE", ZeusConstants.Engines.DOT_NET_SCRIPT, "LANGUAGE", ZeusConstants.Languages.VBNET);
                    break;
                case TemplateEditorManager.VBSCRIPT_TEMPLATE:
                    edit.FileNew("ENGINE", ZeusConstants.Engines.MICROSOFT_SCRIPT, "LANGUAGE", ZeusConstants.Languages.VBSCRIPT);
                    break;
                case TemplateEditorManager.JSCRIPT_TEMPLATE:
                default:
                    edit.FileNew("ENGINE", ZeusConstants.Engines.MICROSOFT_SCRIPT, "LANGUAGE", ZeusConstants.Languages.JSCRIPT);
                    break;
            }

            return edit;
        }
Esempio n. 3
0
 public bool IsTemplateOpen(string filename, TemplateEditor exclude)
 {
     TemplateEditor editor = GetTemplateEditor(filename, exclude);
     return (editor != null);
 }
Esempio n. 4
0
        public TemplateEditor GetTemplateEditor(string filename, TemplateEditor exclude)
        {
            TemplateEditor editor = null;

            FileInfo inf = new FileInfo(filename);
            string tmp = inf.FullName;
            foreach (DockContent cont in dockManager.Contents)
            {
                if ((cont is TemplateEditor) && (cont != exclude))
                {
                    editor = cont as TemplateEditor;
                    if (tmp.ToUpper() == editor.CompleteFilePath.ToUpper())
                    {
                        break;
                    }
                    else
                    {
                        editor = null;
                    }
                }
            }
            return editor;
        }
Esempio n. 5
0
        private void RefreshTemplateEditor(string uniqueId)
        {
            foreach (DockContent cont in dockManager.Contents)
            {
                if (cont is TemplateEditor)
                {
                    TemplateEditor editor = cont as TemplateEditor;
                    if (uniqueId.ToLower() == editor.UniqueID.ToLower())
                    {
                        if (MessageBox.Show(this,
                            "Template [" + editor.Title + "] has been updated outside of the Template Editor.\r\nWould you like to refresh it?",
                            "Refresh Updated Template?",
                            MessageBoxButtons.YesNo) == DialogResult.Yes)
                        {
                            string filename = editor.CompleteFilePath;
                            editor.Close();

                            if (File.Exists(filename))
                            {
                                editor = new TemplateEditor(this);
                                editor.FileOpen(filename);
                                editor.Show(dockManager);
                            }
                        }

                        break;
                    }
                }
            }
        }
Esempio n. 6
0
        private TemplateEditor OpenTemplateEditor(string filename)
        {
            TemplateEditor edit = null;

            if (File.Exists(filename))
            {
                bool isopen = IsTemplateOpen(filename);

                if (!isopen)
                {
                    edit = new TemplateEditor(this);
                    edit.FileOpen(filename);
                    edit.Show(dockManager);
                }
                else
                {
                    edit = GetTemplateEditor(filename);
                    edit.Activate();
                }
            }
            else
            {
                edit = OpenTemplateEditor();
            }

            return edit;
        }
Esempio n. 7
0
 private TemplateEditor OpenTemplateEditor()
 {
     TemplateEditor edit = new TemplateEditor(this);
     edit.FileNew("ENGINE", ZeusConstants.Engines.DOT_NET_SCRIPT, "LANGUAGE", ZeusConstants.Languages.CSHARP);
     edit.Show(dockManager);
     return edit;
 }
Esempio n. 8
0
 private TemplateEditor OpenTemplateEditor(string engine, string language)
 {
     TemplateEditor template = new TemplateEditor(this);
     template.FileNew("ENGINE", engine, "LANGUAGE", language);
     template.Show(dockManager);
     return template;
 }
        public object PerformMdiFuntion(IMyGenContent sender, string function, params object[] args)
        {
            if (function.Equals("getstaticdbroot", StringComparison.CurrentCultureIgnoreCase))
            {
                return MetaDataBrowser.StaticMyMetaObj;
            }
            else if (function.Equals("showoledbdialog", StringComparison.CurrentCultureIgnoreCase) &&
                args.Length == 1)
            {
                return BrowseOleDbConnectionString(args[0].ToString());
            }
            else if (function.Equals("executionqueuestart", StringComparison.CurrentCultureIgnoreCase))
            {
                this.toolStripStatusQueue.Visible = true;
                timerImgAnimate.Start();
            }
            else if (function.Equals("executionqueueupdate", StringComparison.CurrentCultureIgnoreCase))
            {
                if (ZeusProcessManager.ProcessCount == 0)
                {
                    timerImgAnimate.Stop();
                    this.toolStripStatusQueue.Visible = false;
                }
                else if (ZeusProcessManager.ProcessCount > 0)
                {
                    this.toolStripStatusQueue.Visible = true;
                    timerImgAnimate.Start();
                }
            }
            else if (function.Equals("showerrordetail", StringComparison.CurrentCultureIgnoreCase) &&
                args.Length >= 1)
            {
                if (args[0] is List<IMyGenError>)
                {
                    List<IMyGenError> errors = args[0] as List<IMyGenError>;
                    ErrorDetailDockContent.Update(errors[0]);
                    if (this.ErrorDetailDockContent.IsHidden)
                    {
                        this.ErrorDetailDockContent.Show(this.dockPanel);
                    }
                    else
                    {
                        this.ErrorDetailDockContent.Activate();
                    }
                }
            }
            else if (function.Equals("navigatetotemplateerror", StringComparison.CurrentCultureIgnoreCase) &&
                args.Length >= 1)
            {
                if (args[0] is IMyGenError)
                {
                    IMyGenError error = args[0] as IMyGenError;
                    TemplateEditor edit = null;

                    if (string.IsNullOrEmpty(error.SourceFile))
                    {
                        //it's a new unsaved template
                        bool isopen = this.IsDocumentOpen(error.TemplateIdentifier);
                        if (isopen)
                        {
                            edit = this.FindDocument(error.TemplateIdentifier) as TemplateEditor;
                            edit.Activate();
                        }
                    }
                    else
                    {
                        FileInfo file = new FileInfo(error.TemplateFileName);
                        if (file.Exists)
                        {
                            bool isopen = this.IsDocumentOpen(file.FullName);

                            if (!isopen)
                            {
                                edit = new TemplateEditor(this);
                                edit.FileOpen(file.FullName);
                            }
                            else
                            {
                                edit = this.FindDocument(file.FullName) as TemplateEditor;
                                if (edit != null)
                                {
                                    edit.Activate();
                                }
                            }
                        }
                    }

                    if (edit != null)
                    {
                        edit.NavigateTo(error);
                    }
                }
            }

            else if (function.Equals("getmymetadbdriver", StringComparison.CurrentCultureIgnoreCase))
            {
                return DefaultSettings.Instance.DbDriver;
            }
            else if (function.Equals("getmymetaconnection", StringComparison.CurrentCultureIgnoreCase))
            {
                return DefaultSettings.Instance.ConnectionString;
            }
            else if (function.Equals("openfile", StringComparison.CurrentCultureIgnoreCase) &&
                args.Length == 1)
            {
                if (args[0] is List<FileInfo>)
                {
                    List<FileInfo> files = args[0] as List<FileInfo>;
                    foreach (FileInfo fi in files)
                    {
                        Zeus.WindowsTools.LaunchFile(fi.FullName.ToString());
                    }
                }
                else if (args[0] is FileInfo)
                {
                    FileInfo file = args[0] as FileInfo;
                    Zeus.WindowsTools.LaunchFile(file.FullName);
                }
                else if (args[0] is String)
                {
                    Zeus.WindowsTools.LaunchFile(args[0].ToString());
                }
            }
            return null;
        }