Hi,
What he means is that if you have a node (field1) in your schema, you can have an Event handler associated with it:
[InfoPathEventHandler(MatchPath="/my:myRoot/.../my:field1", EventType=InfoPathEventType.OnAfterChange)]
public void field1_OnAfterChange(DataDOMEvent e)
{
// Write code here to restore the global state.
if (e.IsUndoRedo)
{
// An undo or redo operation has occurred and the DOM is read-only.
return;
}
// A field change has occurred and the DOM is writable. Write code here to respond
// to the changes.
}
Now, if you have handlers behind a lot of fields, the performance of your form is going down fast.
Instead, you may have a single OnAfterChange for the entire DOM:
[InfoPathEventHandler(MatchPath="/my:Root", EventType=InfoPathEventType.OnAfterChange)]
public void OnAfterChange(DataDOMEvent e)
{
//Do something there.
}
In there, you want to filter for the nodes you are insterested in, and write the business logic you want.
Basically, if you do the same for the OnBeforeChange event, you end up with "2 global event handlers".
Now, what are you trying to achieve with the code that you posted? Whatever it is, I can tell you there is another way to do it. Please tell me more...
Regards,
Franck Dauché