private void DocumentGroupItemAdd(DocumentPanelCaptionModel caption, Control content) { content.Margin = new Thickness(5); var items = DocumentGroupMain.Items; var singleOrDefaultPanel = items.SingleOrDefault(a => ((DocumentPanelCaptionModel)a.Caption).LeftMenuId == caption.LeftMenuId); if (singleOrDefaultPanel == null) { var documentPanel = new DocumentPanel { Caption = caption, CustomizationCaption = caption.ToString(), AllowFloat = false, AllowHide = false, Content = content, IsActive = true }; items.Add(documentPanel); } else { singleOrDefaultPanel.IsActive = true; } }
/// <summary> /// 处理 Control 控件的显示方式 /// </summary> /// <param name="caption"></param> /// <param name="dllPath"></param> /// <param name="entryFunction"></param> /// <param name="menuId"></param> private void ControlShowOrAddToDocumentGroup(DocumentPanelCaptionModel caption, string dllPath, string entryFunction, string menuId) { var content = GetControl(dllPath, entryFunction, menuId); if (content == null) { return; } if ((content as Window) != null) { ((Window)content).ShowDialog(); } else { DocumentGroupItemAdd(caption, content); } }