다음을 통해 공유


ContextNode.CreatePartiallyPopulatedSubNode 메서드

업데이트: 2007년 11월

Type, IdLocation 정보만 들어 있는 자식 ContextNode 개체를 만듭니다.

네임스페이스:  System.Windows.Ink
어셈블리:  IAWinFX(IAWinFX.dll)

구문

‘선언
Public Function CreatePartiallyPopulatedSubNode ( _
    type As Guid, _
    nodeId As Guid, _
    nodeLocation As AnalysisRegion _
) As ContextNode
‘사용 방법
Dim instance As ContextNode
Dim type As Guid
Dim nodeId As Guid
Dim nodeLocation As AnalysisRegion
Dim returnValue As ContextNode

returnValue = instance.CreatePartiallyPopulatedSubNode(type, _
    nodeId, nodeLocation)
public ContextNode CreatePartiallyPopulatedSubNode(
    Guid type,
    Guid nodeId,
    AnalysisRegion nodeLocation
)
public:
ContextNode^ CreatePartiallyPopulatedSubNode(
    Guid type, 
    Guid nodeId, 
    AnalysisRegion^ nodeLocation
)
public ContextNode CreatePartiallyPopulatedSubNode(
    Guid type,
    Guid nodeId,
    AnalysisRegion nodeLocation
)
public function CreatePartiallyPopulatedSubNode(
    type : Guid, 
    nodeId : Guid, 
    nodeLocation : AnalysisRegion
) : ContextNode

매개 변수

  • nodeId
    형식: System.Guid
    새 노드의 식별자입니다.

반환 값

형식: System.Windows.Ink.ContextNode
Type , IdLocation에 대한 정보만 포함하는 새 ContextNode 개체입니다. 이 새 노드는 ContextNode의 자식입니다.

설명

이 메서드는 일부 관련 정보를 사용할 수 없는 상태에서 컨텍스트 노드 트리에서 ContextNode 개체를 만드는 방법으로 데이터 프록시에 사용됩니다. 이후에 관련 정보를 더 추가할 수 있습니다.

예제

다음 예제는 CreatePartiallyPopulatedNode라는 메서드로, [System.Windows.Controls.TreeView]를 문서 모델로 사용하여 데이터 프록시를 통해 InkAnalyzer에 대한 컨텍스트 노드 트리를 저장하고 로드하는 방법을 보여 줍니다. DocumentNodeData 클래스는 각 TreeViewItem 개체의 [System.Windows.FrameworkElement.Tag] 속성을 DocumentNodeData 개체로 설정하여 ContextNode 데이터를 문서 모델에 저장합니다. CreatePartiallyPopulatedNode 메서드는 TreeViewItem 개체와 InkAnalyzer 개체를 사용하여 문서 모델에서 TreeViewItem에 해당하는 InkAnalyzer 컨텍스트 노드 트리의 부분적으로 채워진 노드를 만듭니다. 이 예제에서 모든 노드는 부분적으로 채워져 생성됩니다. 그런 다음 나중에 노드 데이터로 완전히 채워지는 노드 큐에 배치됩니다.

이 메서드는 전달된 TreeViewItem 개체의 [System.Windows.FrameworkElement.Tag] 속성에서 노드 데이터를 가져옵니다. 그런 다음 Id를 사용하여 노드가 현재 컨텍스트 노드 트리에 없음을 확인합니다. 이 메서드는 트리 뷰 부모 노드를 사용하여 InkAnalyzer에서 해당 부모 노드를 찾습니다. 아직 컨텍스트 노드 트리에 없는 부모 노드는 재귀를 사용하여 추가됩니다. 부모 노드가 트리에 없는 경우에는 부분적으로 채워져야 합니다. 완전히 채워진 경우에는 이미 하위 노드가 모두 포함되어 있으므로 새로 추가할 필요가 없습니다. 따라서 PartiallyPopulated 속성은 부모 노드가 부분적으로 채워졌는지 확인합니다. 부분적으로 채워진 경우에는 나중에 완전히 채워지도록 큐에 추가됩니다. 부분적으로 채워지지 않은 경우에는 예외가 throw됩니다. 마지막으로 [M:System.Windows.Ink.ContextNode.CreatePartiallyPopulatedSubNode (System.Windows.Ink.ContextNodeType,System.Guid,System.Windows.Ink.AnalysisRegion)]가 부모 노드에서 호출되고 새로 생성된 노드는 완전히 채워지도록 노드 큐에 추가됩니다. 새 ContextNode 개체가 반환됩니다. 데이터 프록시에 대한 자세한 내용은 Data Proxy with Ink Analysis을를 참조하십시오.

Private Function CreatePartiallyPopulatedNode(ByVal documentNode As TreeViewItem, ByVal theInkAnalyzer As InkAnalyzer) As ContextNode

    Dim nodeData As DocumentNodeData = documentNode.Tag '

    ' Check that the node does not already exist in the InkAnalyzer.
    If Nothing <> theInkAnalyzer.FindNode(nodeData.Id) Then
        Throw New ApplicationException("The node already exists in the InkAnalyzer.")
    End If

    ' Find the parent analyzer node.
    Dim parentNode As TreeViewItem = documentNode.Parent '

    If parentNode Is Nothing Then
        Throw New Exception("parentNode is not a TreeViewItem")
    End If

    Dim parentNodeData As DocumentNodeData = parentNode.Tag
    Dim analyzerParentNode As ContextNode = theInkAnalyzer.FindNode(parentNodeData.Id)

    If Nothing = analyzerParentNode Then
        ' The parent analyzer node does not exist yet. Create one.
        analyzerParentNode = Me.CreatePartiallyPopulatedNode(parentNode, theInkAnalyzer)
    ElseIf analyzerParentNode.PartiallyPopulated Then
        ' The parent analyzer node exists and is partially populated. Add it
        ' to the stack of nodes to fully populate.
        Me.QueueNodeToPopulate(analyzerParentNode)
    Else
        ' The parent analyzer node exists and is fully populated. This
        ' should not happen.
        Throw New ApplicationException("The parent analyzer node is fully populated.")
    End If

    ' Create the partially populated node under its parent analyzer node.
    Dim analyzerNode As ContextNode = analyzerParentNode.CreatePartiallyPopulatedSubNode(nodeData.Type, nodeData.Id, nodeData.Location)

    ' Add the new node to the stack of nodes to fully populate.
    Me.QueueNodeToPopulate(analyzerNode)

    Return analyzerNode

End Function 'CreatePartiallyPopulatedNode
        private ContextNode CreatePartiallyPopulatedNode(
            TreeViewItem documentNode, InkAnalyzer theInkAnalyzer)
        {
            DocumentNodeData nodeData = documentNode.Tag as DocumentNodeData;

            // Check that the node does not already exist in the InkAnalyzer.
            if (null != theInkAnalyzer.FindNode(nodeData.Id))
            {
                throw new ApplicationException(
                    "The node already exists in the InkAnalyzer.");
            }

            // Find the parent analyzer node.
            TreeViewItem parentNode = documentNode.Parent as TreeViewItem;

            if (parentNode == null)
            {
                throw new Exception("parentNode is not a TreeViewItem");
            }

            DocumentNodeData parentNodeData =
                parentNode.Tag as DocumentNodeData;
            ContextNode analyzerParentNode =
                theInkAnalyzer.FindNode(parentNodeData.Id);
            if (null == analyzerParentNode)
            {
                // The parent analyzer node does not exist yet. Create one.
                analyzerParentNode =
                    this.CreatePartiallyPopulatedNode(
                        parentNode, theInkAnalyzer);
            }
            else if (analyzerParentNode.PartiallyPopulated)
            {
                // The parent analyzer node exists and is partially populated. Add it
                // to the stack of nodes to fully populate.
                this.QueueNodeToPopulate(analyzerParentNode);
            }
            else
            {
                // The parent analyzer node exists and is fully populated. This
                // should not happen.
                throw new ApplicationException(
                    "The parent analyzer node is fully populated.");
            }

            // Create the partially populated node under its parent analyzer node.
            ContextNode analyzerNode =
                analyzerParentNode.CreatePartiallyPopulatedSubNode(
                    nodeData.Type, nodeData.Id, nodeData.Location);

            // Add the new node to the stack of nodes to fully populate.
            this.QueueNodeToPopulate(analyzerNode);

            return analyzerNode;
        }

플랫폼

Windows Vista

.NET Framework 및 .NET Compact Framework에서 모든 플랫폼의 전체 버전을 지원하지는 않습니다. 지원되는 버전의 목록을 보려면 .NET Framework 시스템 요구 사항을 참조하십시오.

버전 정보

.NET Framework

3.0에서 지원

참고 항목

참조

ContextNode 클래스

ContextNode 멤버

System.Windows.Ink 네임스페이스

ContextNode.PartiallyPopulated