Exemplo n.º 1
0
        private TextDocView CreateNewDocument(string text)
        {
            TextDocView dummyDoc = new TextDocView();

            dummyDoc.Text = text;
            return(dummyDoc);
        }
Exemplo n.º 2
0
        private void menuItemLayoutByCode_Click(object sender, System.EventArgs e)
        {
            dockPanel.SuspendLayout(true);

            this.CloseAllContents();

            this.CreateStandardControls();

            m_solutionExplorer.Show(dockPanel, DockState.DockRight);
            m_propertyWindow.Show(m_solutionExplorer.Pane, m_solutionExplorer);
            m_toolbox.Show(dockPanel, new Rectangle(98, 133, 200, 383));
            m_outputWindow.Show(m_solutionExplorer.Pane, DockAlignment.Bottom, 0.35);
            m_taskList.Show(m_toolbox.Pane, DockAlignment.Left, 0.4);

            TextDocView doc1 = this.CreateNewDocument("Document1");
            TextDocView doc2 = this.CreateNewDocument("Document2");
            TextDocView doc3 = this.CreateNewDocument("Document3");
            TextDocView doc4 = this.CreateNewDocument("Document4");

            doc1.Show(dockPanel, DockState.Document);
            doc2.Show(doc1.Pane, null);
            doc3.Show(doc1.Pane, DockAlignment.Bottom, 0.5);
            doc4.Show(doc3.Pane, DockAlignment.Right, 0.5);

            dockPanel.ResumeLayout(true, true);
        }
Exemplo n.º 3
0
        private void menuItemNew_Click(object sender, System.EventArgs e)
        {
            TextDocView dummyDoc = this.CreateNewDocument();

            if (dockPanel.DocumentStyle == DocumentStyle.SystemMdi)
            {
                dummyDoc.MdiParent = this;
                dummyDoc.Show();
            }
            else
            {
                dummyDoc.Show(dockPanel);
            }
        }
Exemplo n.º 4
0
        private TextDocView CreateNewDocument()
        {
            TextDocView dummyDoc = new TextDocView();

            int    count = 1;
            string text  = $"Document{count}";

            while (this.FindDocument(text) != null)
            {
                count++;
                text = $"Document{count}";
            }

            dummyDoc.Text = text;
            return(dummyDoc);
        }
Exemplo n.º 5
0
        internal void OpenFile(string filepath)
        {
            var fileName  = Path.GetFileName(filepath);
            var extension = Path.GetExtension(filepath);

            if (this.FindDocument(fileName) != null)
            {
                MessageBox.Show("The document: " + fileName + " is already opened!");
                return;
            }

            if (extension == "." + Main.StepBroFileExtension)
            {
                var docView = new StepBroScriptDocView(m_resourceUserObject)
                {
                    Text = fileName
                };
                this.ShowDocView(docView);
                try
                {
                    docView.OpenFile(filepath);
                }
                catch (Exception exception)
                {
                    docView.Close();
                    MessageBox.Show(exception.Message);
                }
            }
            else
            {
                var docView = new TextDocView
                {
                    Text = fileName
                };
                this.ShowDocView(docView);
                try
                {
                    docView.OpenFile(filepath);
                }
                catch (Exception exception)
                {
                    docView.Close();
                    MessageBox.Show(exception.Message);
                }
            }
        }
Exemplo n.º 6
0
        private IDockContent GetContentFromPersistString(string persistString)
        {
            var found = AppDomain.CurrentDomain.GetAssemblies().
                        SelectMany(a => a.GetExportedTypes()).
                        Where(t => String.Equals(t.FullName, persistString, StringComparison.InvariantCulture));

            if (persistString == typeof(FileExplorer).ToString())
            {
                return(m_solutionExplorer);
            }
            else if (persistString == typeof(DummyPropertyWindow).ToString())
            {
                return(m_propertyWindow);
            }
            else if (persistString == typeof(DummyToolbox).ToString())
            {
                return(m_toolbox);
            }
            else if (persistString == typeof(OutputWindow).ToString())
            {
                return(m_outputWindow);
            }
            else if (persistString == typeof(ErrorsWindow).ToString())
            {
                return(m_errorListWindow);
            }
            else if (persistString == typeof(DummyTaskList).ToString())
            {
                return(m_taskList);
            }
            else if (persistString == typeof(EditorPlayground).ToString())
            {
                return(m_editorPlayground);
            }
            else
            {
                // DummyDoc overrides GetPersistString to add extra information into persistString.
                // Any DockContent may override this value to add any needed information for deserialization.

                string[] parsedStrings = persistString.Split(new char[] { ',' });
                if (parsedStrings.Length != 3)
                {
                    return(null);
                }

                if (parsedStrings[0] == typeof(TextDocView).ToString())
                {
                    TextDocView doc = new TextDocView(m_resourceUserObject);
                    if (parsedStrings[1] != string.Empty)
                    {
                        if (!doc.OpenFile(parsedStrings[1]))
                        {
                            return(null);
                        }
                    }
                    if (parsedStrings[2] != string.Empty)
                    {
                        doc.Text = parsedStrings[2];
                    }

                    return(doc);
                }
                else if (parsedStrings[0] == typeof(StepBroScriptDocView).ToString())
                {
                    StepBroScriptDocView doc = new StepBroScriptDocView(m_resourceUserObject);
                    if (parsedStrings[1] != string.Empty)
                    {
                        if (!doc.OpenFile(parsedStrings[1]))
                        {
                            return(null);
                        }
                    }
                    if (parsedStrings[2] != string.Empty)
                    {
                        doc.Text = parsedStrings[2];
                    }

                    return(doc);
                }
                else if (parsedStrings[0] == ObjectPanelDockWindow.PersistTitle)
                {
                    var view = new ObjectPanelDockWindow(StepBroMain.ServiceManager);
                    view.SetupFromLoadSpecification(parsedStrings.Skip(1).ToArray());
                    return(view);
                }
                else
                {
                    return(null);
                }
            }
        }