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 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 Open(IMyGenerationMDI mdi, FileInfo file, params string[] args)
        {
            ProjectBrowser edit = null;

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

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

            return edit;
        }
示例#4
0
        public override IMyGenDocument Open(IMyGenerationMDI mdi, FileInfo file, params string[] args)
        {
            ProjectBrowser edit = null;

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

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

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

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

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

            return edit;
        }
示例#6
0
        public IMyGenDocument Open(IMyGenerationMDI mdi, FileInfo file, params string[] args)
        {
            SqlToolForm edit = null;

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

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

            return(edit);
        }
示例#7
0
        private void FileSaveAs(string path)
        {
            bool isopen = _mdi.IsDocumentOpen(path, this.Parent as IMyGenDocument);

            if (!isopen)
            {
                FileInfo fi = new FileInfo(path);
                if (fi.Exists)
                {
                    if (fi.IsReadOnly)
                    {
                        MessageBox.Show(this, "File is read only, cannot save.");
                        this._mdi.Console.Write("File \"{0}\" is read only, cannot save.", fi.FullName);
                    }
                    else
                    {
                        try
                        {
                            File.WriteAllText(path, scintilla.Text);
                            this._filename = path;

                            SetClean();
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show(this, "Error saving file. " + ex.Message);
                            this._mdi.Console.Write("Error saving file.");
                            this._mdi.Console.Write(ex);
                        }
                    }
                }
            }
            else
            {
                MessageBox.Show(this, "The template you are trying to overwrite is currently open.\r\nClose the editor window for that template if you want to overwrite it.");
            }
        }