InkAnalyzerBase.ContextNodeCreatedBase 事件
在墨迹分析器创建 ContextNodeBase 后发生。
命名空间: System.Windows.Ink.AnalysisCore
程序集: IACore(在 IACore.dll 中)
语法
声明
Public Event ContextNodeCreatedBase As ContextNodeCreatedBaseEventHandler
用法
Dim instance As InkAnalyzerBase
Dim handler As ContextNodeCreatedBaseEventHandler
AddHandler instance.ContextNodeCreatedBase, handler
public event ContextNodeCreatedBaseEventHandler ContextNodeCreatedBase
public:
event ContextNodeCreatedBaseEventHandler^ ContextNodeCreatedBase {
void add (ContextNodeCreatedBaseEventHandler^ value);
void remove (ContextNodeCreatedBaseEventHandler^ value);
}
/** @event */
public void add_ContextNodeCreatedBase (ContextNodeCreatedBaseEventHandler value)
/** @event */
public void remove_ContextNodeCreatedBase (ContextNodeCreatedBaseEventHandler value)
JScript 不支持事件。
备注
如果您的应用程序维护其自己的数据结构(该数据结构与 InkAnalyzerBase 的数据结构同步),请使用此事件。在墨迹分析的协调阶段中,或是在响应用于创建 ContextNodeBase 的墨迹分析方法时,将发生此事件。
当墨迹分析器创建上下文节点时,新的上下文节点不包含任何笔画,也不包含到其他上下文节点的链接,还可能未设置其所有属性。而且,新的上下文节点会添加到其父级的 SubNodes 集合的末尾。在此事件之后,墨迹分析器可能引发以下事件。
StrokesReparentedBase 事件,在将笔画从一个上下文节点移动至另一个节点时引发。
ContextNodeLinkAddingBase 事件,在将 ContextLinkBase 添加到上下文节点时引发。
ContextNodeMovingToPositionBase 事件,在墨迹分析器更改其父节点的 SubNodes 集合中的上下文节点的顺序时引发。
ContextNodePropertiesUpdatedBase 事件,在墨迹分析器解析此分析阶段的上下文节点状态之后引发。
有关将应用程序数据与 InkAnalyzerBase 同步的更多信息,请参见Data Proxy with Ink Analysis。
示例
下面的示例定义方法 AttachDataProxyEventHandlers,该方法将数据代理事件处理程序附加到 InkAnalyzerBase (baseInkAnalyzer)。
Private Sub AttachDataProxyEventHandlers()
' If the document model supports on demand data proxy, then add an
' event handler for the PopulateContextNodeBase event. This event is raised
' when the InkAnalyzerBase accesses a partially populated ContextNodeBase
' created by the document model.
If Me.baseDocumentModel.SupportsOnDemandDataProxy Then
AddHandler Me.baseInkAnalyzer.PopulateContextNodeBase, AddressOf Me.PopulateContextNodeBase
End If
' Add the other data proxy related event handlers. These events are raised
' by the InkAnalyzer to communicate parsing results to the document model.
AddHandler Me.baseInkAnalyzer.ContextNodeCreatedBase, _
AddressOf Me.AddContextNodeBase
AddHandler Me.baseInkAnalyzer.ContextNodeDeletingBase, _
AddressOf Me.RemoveContextNodeBase
AddHandler Me.baseInkAnalyzer.ContextNodeLinkAddingBase, _
AddressOf Me.AddContextNodeLinkBase
AddHandler Me.baseInkAnalyzer.ContextNodeLinkDeletingBase, _
AddressOf Me.RemoveContextNodeLinkBase
AddHandler Me.baseInkAnalyzer.ContextNodeMovingToPositionBase, _
AddressOf Me.MoveContextNodeBaseToPosition
AddHandler Me.baseInkAnalyzer.ContextNodePropertiesUpdatedBase, _
AddressOf Me.UpdateContextNodeBaseProperties
AddHandler Me.baseInkAnalyzer.ContextNodeReparentingBase, _
AddressOf Me.ReparentContextNodeBase
AddHandler Me.baseInkAnalyzer.InkAnalyzerStateChangingBase, _
AddressOf Me.InkAnalyzerBase_StateChanging
AddHandler Me.baseInkAnalyzer.StrokesReparentedBase, _
AddressOf Me.ReparentStroke
AddHandler Me.baseInkAnalyzer.IntermediateResultsUpdatedBase, _
AddressOf Me.BaseResultsAvailable
AddHandler Me.baseInkAnalyzer.ResultsUpdatedBase, _
AddressOf Me.BaseResultsAvailable
End Sub 'AttachDataProxyEventHandlers
private void AttachDataProxyEventHandlers()
{
// If the document model supports on demand data proxy, then add an
// event handler for the PopulateContextNodeBase event. This event is raised
// when the InkAnalyzerBase accesses a partially populated ContextNodeBase
// created by the document model.
if (this.baseDocumentModel.SupportsOnDemandDataProxy)
{
this.baseInkAnalyzer.PopulateContextNodeBase +=
new System.Windows.Ink.AnalysisCore.PopulateContextNodeBaseEventHandler(
this.PopulateContextNodeBase);
}
// Add the other data proxy related event handlers. These events are raised
// by the InkAnalyzer to communicate parsing results to the document model.
this.baseInkAnalyzer.ContextNodeCreatedBase +=
new System.Windows.Ink.AnalysisCore.ContextNodeCreatedBaseEventHandler(
this.AddContextNodeBase);
this.baseInkAnalyzer.ContextNodeDeletingBase +=
new System.Windows.Ink.AnalysisCore.ContextNodeDeletingBaseEventHandler(
this.RemoveContextNodeBase);
this.baseInkAnalyzer.ContextNodeLinkAddingBase +=
new System.Windows.Ink.AnalysisCore.ContextNodeLinkAddingBaseEventHandler(
this.AddContextNodeLinkBase);
this.baseInkAnalyzer.ContextNodeLinkDeletingBase +=
new System.Windows.Ink.AnalysisCore.ContextNodeLinkDeletingBaseEventHandler(
this.RemoveContextNodeLinkBase);
this.baseInkAnalyzer.ContextNodeMovingToPositionBase +=
new System.Windows.Ink.AnalysisCore.ContextNodeMovingToPositionBaseEventHandler(
this.MoveContextNodeBaseToPosition);
this.baseInkAnalyzer.ContextNodePropertiesUpdatedBase +=
new System.Windows.Ink.AnalysisCore.ContextNodePropertiesUpdatedBaseEventHandler(
this.UpdateContextNodeBaseProperties);
this.baseInkAnalyzer.ContextNodeReparentingBase +=
new System.Windows.Ink.AnalysisCore.ContextNodeReparentingBaseEventHandler(
this.ReparentContextNodeBase);
this.baseInkAnalyzer.InkAnalyzerStateChangingBase +=
new System.Windows.Ink.AnalysisCore.InkAnalyzerStateChangingBaseEventHandler(
this.InkAnalyzerBase_StateChanging);
this.baseInkAnalyzer.StrokesReparentedBase +=
new System.Windows.Ink.AnalysisCore.StrokesReparentedBaseEventHandler(
this.ReparentStroke);
this.baseInkAnalyzer.IntermediateResultsUpdatedBase +=
new System.Windows.Ink.AnalysisCore.ResultsUpdatedBaseEventHandler(
this.BaseResultsAvailable);
this.baseInkAnalyzer.ResultsUpdatedBase +=
new System.Windows.Ink.AnalysisCore.ResultsUpdatedBaseEventHandler(
this.BaseResultsAvailable);
}
下面的示例定义 AddContextNodeBase 方法,用以处理 ContextNodeCreatedBase 事件。事件信息将传递给文档模型对象 baseDocumentModel。
此示例不提供文档模型的定义,也不演示文档模型如何处理传入的信息。
''' <summary>
''' Handles the InkAnalyzerBase.ContextNodeCreatedBase event.
''' </summary>
''' <param name="sender">The source of the event.</param>
''' <param name="e">The event data.</param>
''' <remarks>
''' Note: when this event is fired, the ContextNodeBase has not been populated
''' with extended and other properties. Handle the ContextNodePropertiesUpdatedBase
''' event to populate the corresponding ContextNodeBase in the document model.
''' </remarks>
Private Sub AddContextNodeBase( _
ByVal sender As Object, _
ByVal e As System.Windows.Ink.AnalysisCore.ContextNodeCreatedBaseEventArgs)
' Do not add unclassified ink nodes to the document model.
If System.Windows.Ink.AnalysisCore.ContextNodeTypeBase.UnclassifiedInk <> e.NodeCreated.Type Then
Me.baseDocumentModel.AddNode(e.NodeCreated)
End If
End Sub 'AddContextNodeBase
/// <summary>
/// Handles the InkAnalyzerBase.ContextNodeCreatedBase event.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The event data.</param>
/// <remarks>
/// Note: when this event is fired, the ContextNodeBase has not been populated
/// with extended and other properties. Handle the ContextNodePropertiesUpdatedBase
/// event to populate the corresponding ContextNodeBase in the document model.
/// </remarks>
private void AddContextNodeBase(
object sender, System.Windows.Ink.AnalysisCore.ContextNodeCreatedBaseEventArgs e)
{
// Do not add unclassified ink nodes to the document model.
if (System.Windows.Ink.AnalysisCore.ContextNodeTypeBase.UnclassifiedInk
!= e.NodeCreated.Type)
{
this.baseDocumentModel.AddNode(e.NodeCreated);
}
}
平台
Windows Vista, Windows XP SP2, Windows Server 2003
.NET Framework 和 .NET Compact Framework 并不是对每个平台的所有版本都提供支持。有关支持的版本的列表,请参见.NET Framework 系统要求。
版本信息
.NET Framework
受以下版本支持:3.0
另请参见
参考
System.Windows.Ink.AnalysisCore 命名空间
InkAnalyzerBase.ContextNodeDeletingBase
InkAnalyzerBase.ContextNodeLinkAddingBase
InkAnalyzerBase.ContextNodeMovingToPositionBase