Пример #1
0
        private void toolStripMenuItemCreateAllObjectPanels_Click(object sender, EventArgs e)
        {
            var objects      = StepBroMain.GetService <Core.Data.IDynamicObjectManager>().ListKnownObjects().ToList();
            var panelManager = StepBroMain.GetService <Core.Data.IObjectPanelManager>();

            foreach (var panelInfo in panelManager.ListPanelTypes().Where(t => t.IsObjectPanel))
            {
                foreach (var objContainer in objects)
                {
                    if (objContainer.Object != null && panelInfo.IsCompatibleWithObject(objContainer.Object))
                    {
                        if (panelManager.GetPanelCreationOption(panelInfo, objContainer) == Core.Data.PanelCreationOption.Possible)
                        {
                            var panel = panelManager.CreateObjectWinFormsPanel(panelInfo, objContainer);
                            if (panel != null)
                            {
                                var window = new ObjectPanelDockWindow(StepBroMain.ServiceManager);
                                window.SetPanel(panelInfo, panel);
                                window.Show(dockPanel);
                            }
                        }
                    }
                }
            }
        }
Пример #2
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);
                }
            }
        }