예제 #1
0
        /// <summary>
        /// Ensures that all possible secondary view contents are attached.
        /// This is primarily used to add the FormsDesigner view content for files
        /// containing partial classes after the designer file has been parsed if
        /// the view content has been created too early on startup.
        /// </summary>
        void RefreshSecondaryViewContents()
        {
            if (content == null)
            {
                return;
            }
            int oldSvcCount = content.SecondaryViewContents.Count;

            DisplayBindingService.AttachSubWindows(content, true);
            if (content.SecondaryViewContents.Count > oldSvcCount)
            {
                LoggingService.Debug("Attaching new secondary view contents to '" + this.Title + "'");
                if (viewTabControl == null)
                {
                    // The tab control needs to be created first.
                    Controls.Remove(content.Control);
                    CreateViewTabControl();
                    AttachSecondaryViewContent(content);
                    Controls.Add(viewTabControl);
                }
                foreach (ISecondaryViewContent svc in content.SecondaryViewContents)
                {
                    if (svc.WorkbenchWindow == null)
                    {
                        AttachSecondaryViewContent(svc);
                    }
                }
            }
        }