本文整理汇总了C#中AvalonDock.DocumentContent.FirstOrDefault方法的典型用法代码示例。如果您正苦于以下问题:C# DocumentContent.FirstOrDefault方法的具体用法?C# DocumentContent.FirstOrDefault怎么用?C# DocumentContent.FirstOrDefault使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AvalonDock.DocumentContent
的用法示例。
在下文中一共展示了DocumentContent.FirstOrDefault方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RestoreDocumentPaneLayout
///// <summary>
///// Restore from xml a document pane
///// </summary>
///// <param name="childElement"></param>
///// <param name="mainExistingDocumentPane"></param>
///// <param name="existingDocumentPanel"></param>
///// <param name="dockableContents"></param>
//void RestoreDocumentPaneLayout(XmlElement childElement, out DocumentPane mainExistingDocumentPane, out DocumentPaneResizingPanel existingDocumentPanel, DockableContent[] dockableContents)
//{
// mainExistingDocumentPane = (Content is DocumentPane) ? Content as DocumentPane : GetMainDocumentPane(Content as ResizingPanel);
// if (mainExistingDocumentPane != null)
// {
// existingDocumentPanel = mainExistingDocumentPane.GetParentDocumentPaneResizingPanel();
// }
// else
// {
// existingDocumentPanel = null;
// }
// if (existingDocumentPanel != null)
// {
// if (existingDocumentPanel.Parent is ResizingPanel)
// {
// ((ResizingPanel)existingDocumentPanel.Parent).RemoveChild(existingDocumentPanel);
// }
// else if (existingDocumentPanel.Parent is DockingManager)
// {
// ((DockingManager)existingDocumentPanel.Parent).Content = null;
// }
// }
// else if (mainExistingDocumentPane != null)
// {
// if (mainExistingDocumentPane.Parent is ResizingPanel)
// {
// ((ResizingPanel)mainExistingDocumentPane.Parent).RemoveChild(mainExistingDocumentPane);
// }
// else if (mainExistingDocumentPane.Parent is DockingManager)
// {
// ((DockingManager)mainExistingDocumentPane.Parent).Content = null;
// }
// }
// foreach (XmlElement contentElement in childElement.ChildNodes)
// {
// if (contentElement.HasAttribute("Name"))
// {
// DockableContent foundContent = null;
// string contentName = contentElement.GetAttribute("Name");
// foreach (DockableContent content in dockableContents)
// {
// if (content.Name == contentName)
// {
// foundContent = content;
// break;
// }
// }
// if (foundContent == null &&
// DeserializationCallback != null)
// {
// DeserializationCallbackEventArgs e = new DeserializationCallbackEventArgs(contentName);
// DeserializationCallback(this, e);
// foundContent = e.Content as DockableContent;
// }
// if (foundContent != null)
// {
// DetachContentFromDockingManager(foundContent);
// mainExistingDocumentPane.Items.Add(foundContent);
// foundContent.SetStateToDocument();
// //call custom layout persistence method
// foundContent.RestoreLayout(contentElement);
// }
// }
// }
//}
DocumentPane RestoreDocumentPaneLayout(XmlElement mainElement, DockableContent[] actualContents, DocumentContent[] actualDocuments)
{
var documentPane = new DocumentPane();
if (mainElement.HasAttribute("ResizeWidth"))
ResizingPanel.SetResizeWidth(documentPane, (GridLength)GLConverter.ConvertFromInvariantString(mainElement.GetAttribute("ResizeWidth")));
if (mainElement.HasAttribute("ResizeHeight"))
ResizingPanel.SetResizeHeight(documentPane, (GridLength)GLConverter.ConvertFromInvariantString(mainElement.GetAttribute("ResizeHeight")));
if (mainElement.HasAttribute("EffectiveSize"))
ResizingPanel.SetEffectiveSize(documentPane, (Size)(new SizeConverter()).ConvertFromInvariantString(mainElement.GetAttribute("EffectiveSize")));
foreach (XmlElement contentElement in mainElement.ChildNodes)
{
if (contentElement.Name == "DockableContent" &&
contentElement.HasAttribute("Name"))
{
DockableContent foundContent = null;
string contentName = contentElement.GetAttribute("Name");
foundContent = actualContents.FirstOrDefault(c => c.Name == contentName);
if (foundContent == null &&
DeserializationCallback != null)
{
DeserializationCallbackEventArgs e = new DeserializationCallbackEventArgs(contentName);
DeserializationCallback(this, e);
foundContent = e.Content as DockableContent;
//.........这里部分代码省略.........