/// <summary> /// Shows the content. /// </summary> /// <param name="vc">The view content.</param> internal void ShowContent(IViewContent vc) { DockContent content = new DockContent(); content.TabText = vc.Title; content.Text = vc.Title; content.ToolTipText = vc.Description; content.CloseButton = vc.AllowUserClose; content.CloseButtonVisible = vc.AllowUserClose; content.Tag = vc; var icon = vc.ViewIcon; if (icon != null) { content.Icon = icon; content.ShowIcon = true; } if (vc.IsExclusiveToDocumentRegion) { content.DockAreas = DockAreas.Document; } else { content.DockAreas = (DockAreas)(vc.DefaultRegion); } vc.SetParentForm(content); vc.ViewContentActivating += (sender, e) => { content.Activate(); }; vc.TitleChanged += (sender, e) => { content.TabText = vc.Title; content.Text = vc.Title; }; vc.DescriptionChanged += (sender, e) => { content.ToolTipText = vc.Description; }; if (vc.AllowUserClose && vc.IsExclusiveToDocumentRegion) { content.TabPageContextMenuStrip = documentTabContextMenu; } content.ClientSize = vc.ContentControl.Size; vc.ContentControl.Dock = DockStyle.Fill; content.Controls.Add(vc.ContentControl); if (vc.IsModalWindow && vc.DefaultRegion == ViewRegion.Floating) { content.StartPosition = FormStartPosition.CenterParent; content.ShowDialog(); } else { content.Show(contentPanel); } }
/// <summary> /// Shows the content. /// </summary> /// <param name="vc">The vc.</param> internal void ShowContent(IViewContent vc) { DockContent content = new DockContent(); content.TabText = vc.Title; content.Text = vc.Title; content.ToolTipText = vc.Description; content.CloseButton = vc.AllowUserClose; content.CloseButtonVisible = vc.AllowUserClose; content.Tag = vc; var icon = vc.ViewIcon; if (icon != null) { content.Icon = icon; content.ShowIcon = true; } if (vc.IsExclusiveToDocumentRegion) { content.DockAreas = DockAreas.Document; } else { content.DockAreas = (DockAreas)(vc.DefaultRegion); } vc.SetParentForm(content); vc.ViewContentActivating += (sender, e) => { content.Activate(); }; vc.TitleChanged += (sender, e) => { content.TabText = vc.Title; content.Text = vc.Title; }; vc.DescriptionChanged += (sender, e) => { content.ToolTipText = vc.Description; }; if (vc.AllowUserClose && vc.IsExclusiveToDocumentRegion) content.TabPageContextMenuStrip = documentTabContextMenu; content.ClientSize = vc.ContentControl.Size; vc.ContentControl.Dock = DockStyle.Fill; content.Controls.Add(vc.ContentControl); if (vc.IsModalWindow && vc.DefaultRegion == ViewRegion.Floating) { content.StartPosition = FormStartPosition.CenterParent; content.ShowDialog(); } else { content.Show(contentPanel); } }