本文整理汇总了C#中IDocument.As方法的典型用法代码示例。如果您正苦于以下问题:C# IDocument.As方法的具体用法?C# IDocument.As怎么用?C# IDocument.As使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDocument
的用法示例。
在下文中一共展示了IDocument.As方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Show
/// <summary>
/// Makes the document visible to the user</summary>
/// <param name="document">Document to show</param>
public void Show(IDocument document)
{
ViewingContext viewingContext = document.As<ViewingContext>();
m_controlHostService.Show(viewingContext.Control);
}
示例2: Close
/// <summary>
/// Closes the document and removes any views of it from the UI</summary>
/// <param name="document">Document to close</param>
public void Close(IDocument document)
{
EditingContext context = document.As<EditingContext>();
// close all active EditingContexts in the document
foreach (DomNode node in context.DomNode.Subtree)
foreach (EditingContext editingContext in node.AsAll<EditingContext>())
m_contextRegistry.RemoveContext(editingContext);
// close the document
m_documentRegistry.Remove(document);
// finally unregister the control and release the reference to it
ViewingContext viewingContext = document.As<ViewingContext>();
m_controlHostService.UnregisterControl(viewingContext.Control);
viewingContext.Control.Dispose();
viewingContext.Control = null;
}
示例3: Close
/// <summary>
/// Closes the document and removes any views of it from the UI</summary>
/// <param name="document">Document to close</param>
public void Close(IDocument document)
{
StoryDocument doc = document.As<StoryDocument>();
m_controlHostService.UnregisterControl(doc.Control);
// close the document
m_documentRegistry.Remove(document);
}
示例4: Show
/// <summary>
/// Makes the document visible to the user</summary>
/// <param name="document">Document to show</param>
public void Show(IDocument document)
{
StoryDocument doc = document.As<StoryDocument>();
m_controlHostService.Show(doc.Control);
}
示例5: IsObjectPartOfDocument
private bool IsObjectPartOfDocument(IDocument document, object obj)
{
if (document == null || obj == null) return false;
if (document.Equals(obj)) return true;
//try enumerable context.
var enumContext = document.As<IEnumerableContext>();
if (enumContext != null && enumContext.Items != null)
{
if (enumContext.Items.Any(elm => AdaptableEquals(elm, obj)))
return true;
}
return false;
}