-
Notifications
You must be signed in to change notification settings - Fork 8
/
_DataDOMEventSink_Event.xml
226 lines (222 loc) · 14.5 KB
/
_DataDOMEventSink_Event.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
<Type Name="_DataDOMEventSink_Event" FullName="Microsoft.Office.Interop.InfoPath.SemiTrust._DataDOMEventSink_Event">
<TypeSignature Language="C#" Value="public interface _DataDOMEventSink_Event" />
<TypeSignature Language="ILAsm" Value=".class public interface auto ansi abstract _DataDOMEventSink_Event" />
<TypeSignature Language="DocId" Value="T:Microsoft.Office.Interop.InfoPath.SemiTrust._DataDOMEventSink_Event" />
<TypeSignature Language="VB.NET" Value="Public Interface _DataDOMEventSink_Event" />
<TypeSignature Language="C++ CLI" Value="public interface class _DataDOMEventSink_Event" />
<TypeSignature Language="F#" Value="type _DataDOMEventSink_Event = interface" />
<AssemblyInfo>
<AssemblyName>Microsoft.Office.Interop.InfoPath.SemiTrust</AssemblyName>
<AssemblyVersion>11.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Interfaces />
<Attributes>
<Attribute>
<AttributeName>System.Runtime.InteropServices.ComEventInterface(typeof(Microsoft.Office.Interop.InfoPath.SemiTrust._DataDOMEventSink), typeof(Microsoft.Office.Interop.InfoPath.SemiTrust._DataDOMEventSink_EventProvider))</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.Runtime.InteropServices.ComVisible(false)</AttributeName>
</Attribute>
</Attributes>
<Docs>
<summary>Implements events for changes to a form's underlying XML document.</summary>
<remarks>To be added.</remarks>
</Docs>
<Members>
<Member MemberName="OnAfterChange">
<MemberSignature Language="C#" Value="event Microsoft.Office.Interop.InfoPath.SemiTrust._DataDOMEventSink_OnAfterChangeEventHandler OnAfterChange;" />
<MemberSignature Language="ILAsm" Value=".event class Microsoft.Office.Interop.InfoPath.SemiTrust._DataDOMEventSink_OnAfterChangeEventHandler OnAfterChange" />
<MemberSignature Language="DocId" Value="E:Microsoft.Office.Interop.InfoPath.SemiTrust._DataDOMEventSink_Event.OnAfterChange" />
<MemberSignature Language="VB.NET" Value="Event OnAfterChange As _DataDOMEventSink_OnAfterChangeEventHandler " />
<MemberSignature Language="C++ CLI" Value="public:
 event Microsoft::Office::Interop::InfoPath::SemiTrust::_DataDOMEventSink_OnAfterChangeEventHandler ^ OnAfterChange;" />
<MemberSignature Language="F#" Value="member this.OnAfterChange : Microsoft.Office.Interop.InfoPath.SemiTrust._DataDOMEventSink_OnAfterChangeEventHandler " Usage="member this.OnAfterChange : Microsoft.Office.Interop.InfoPath.SemiTrust._DataDOMEventSink_OnAfterChangeEventHandler " />
<MemberType>Event</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.Office.Interop.InfoPath.SemiTrust</AssemblyName>
<AssemblyVersion>11.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>Microsoft.Office.Interop.InfoPath.SemiTrust._DataDOMEventSink_OnAfterChangeEventHandler</ReturnType>
</ReturnValue>
<Docs>
<summary>Occurs after changes to a form's underlying XML document have been accepted and after the <see cref="E:Microsoft.Office.Interop.InfoPath.SemiTrust._DataDOMEventSink_Event.OnValidate" /> event has occurred.</summary>
<remarks>
<para>This event handler does not allow users to cancel an operation.</para>
<para>The <b>OnAfterChange</b> event is typically used for changing data in a form after other changes have occurred — for example, making calculations or changing the structure of a form's underlying XML document.</para>
<para>
<b>Note</b>: In some cases, events related to changes in a form's underlying XML document may occur more than once. For example, when existing data is changed, an insert and delete operation occurs.</para>
<para />
</remarks>
<example>
<code>[InfoPathEventHandler(MatchPath="/my:myFields/my:field1", EventType=InfoPathEventType.<span class="label">OnAfterChange</span>)]
public void field1_<span class="label">OnAfterChange</span>(DataDOMEvent e)
{
if (e.IsUndoRedo)
{
// An undo or redo operation has occurred and the DOM is read-only.
return;
}
CalculateTotalCampaignCost();
}</code>
</example>
<example>
<code>[InfoPathEventHandler(MatchPath="/my:myFields/my:field1", EventType=InfoPathEventType.<span class="label">OnAfterChange</span>)]
public void field1_<span class="label">OnAfterChange</span>(DataDOMEvent e)
{
if (e.IsUndoRedo)
{
// An undo or redo operation has occurred and the DOM is read-only.
return;
}
CalculateTotalCampaignCost();
}</code>
</example>
</Docs>
</Member>
<Member MemberName="OnBeforeChange">
<MemberSignature Language="C#" Value="event Microsoft.Office.Interop.InfoPath.SemiTrust._DataDOMEventSink_OnBeforeChangeEventHandler OnBeforeChange;" />
<MemberSignature Language="ILAsm" Value=".event class Microsoft.Office.Interop.InfoPath.SemiTrust._DataDOMEventSink_OnBeforeChangeEventHandler OnBeforeChange" />
<MemberSignature Language="DocId" Value="E:Microsoft.Office.Interop.InfoPath.SemiTrust._DataDOMEventSink_Event.OnBeforeChange" />
<MemberSignature Language="VB.NET" Value="Event OnBeforeChange As _DataDOMEventSink_OnBeforeChangeEventHandler " />
<MemberSignature Language="C++ CLI" Value="public:
 event Microsoft::Office::Interop::InfoPath::SemiTrust::_DataDOMEventSink_OnBeforeChangeEventHandler ^ OnBeforeChange;" />
<MemberSignature Language="F#" Value="member this.OnBeforeChange : Microsoft.Office.Interop.InfoPath.SemiTrust._DataDOMEventSink_OnBeforeChangeEventHandler " Usage="member this.OnBeforeChange : Microsoft.Office.Interop.InfoPath.SemiTrust._DataDOMEventSink_OnBeforeChangeEventHandler " />
<MemberType>Event</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.Office.Interop.InfoPath.SemiTrust</AssemblyName>
<AssemblyVersion>11.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>Microsoft.Office.Interop.InfoPath.SemiTrust._DataDOMEventSink_OnBeforeChangeEventHandler</ReturnType>
</ReturnValue>
<Docs>
<summary>Occurs after changes to a form's underlying XML document have been made but before the changes are accepted.</summary>
<remarks>
<para>This event handler allows users to cancel a DataDOM operation.</para>
<para>During the <b>OnBeforeChange</b> event, the form's underlying XML document is placed in read-only mode. If the <see cref="P:Microsoft.Office.Interop.InfoPath.SemiTrust.DataDOMEvent.ReturnStatus" /> property of the <see cref="T:Microsoft.Office.Interop.InfoPath.SemiTrust.DataDOMEventObject" /> object is set to <b>false</b>, Microsoft InfoPath rejects the changes that were made and a message box is displayed to the user. If an error occurs in the code for the <b>OnBeforeChange</b> event, InfoPath rejects the changes and restores the data to its previous state.</para>
<para>
<b>Note</b>: It is best to avoid switching views during the <b>OnBeforeChange</b> event; changes have not yet been accepted, and switching to another view may result in an error.</para>
<para>
<b>Note</b>: In some cases, events related to changes in a form's underlying XML document may occur more than once. For example, when existing data is changed, an insert and delete operation occurs.</para>
<para>
<b>Note</b>: If a validation error is encountered in the <b>OnBeforeChange</b> event, the document fails to load. A try/catch block in the <see cref="E:Microsoft.Office.Interop.InfoPath.SemiTrust._XDocumentEventSink2_Event.OnLoad" /> event can be used to catch this validation failure and to load the document despite the error.</para>
<para />
</remarks>
<example>
<para>In the following example, the <b>OnBeforeChange</b> event handler is used to validate the data in a field. If the data is not valid, the <see cref="P:Microsoft.Office.Interop.InfoPath.SemiTrust.DataDOMEvent.ReturnStatus" /> property of the <see cref="T:Microsoft.Office.Interop.InfoPath.SemiTrust.DataDOMEventObject" /> object is used to reject the changes.</para>
<code>[InfoPathEventHandler(MatchPath="/Customers/Customer/RepVisitDt", EventType=InfoPathEventType.<span class="label">OnBeforeChange</span>)]
public void RepVisitDt_<span class="label">OnBeforeChange</span>(DataDOMEvent e)
{
IXMLDOMNode phone = thisXDocument.DOM.selectSingleNode (@"/Customers/CustomerInfo/ContactDates/PhoneContactDt");
if (phone.text == "")
{
e.ReturnMessage = "The Phone Contact Start date must be set prior to the Representative Visit date.";
e.ReturnStatus = false;
return;
}
// If the data is valid, eventObj.ReturnStatus = true.
e.ReturnStatus = true;
return;
}</code>
</example>
<example>
<para>In the following example, the <b>OnBeforeChange</b> event handler is used to validate the data in a field. If the data is not valid, the <see cref="P:Microsoft.Office.Interop.InfoPath.SemiTrust.DataDOMEvent.ReturnStatus" /> property of the <see cref="T:Microsoft.Office.Interop.InfoPath.SemiTrust.DataDOMEventObject" /> object is used to reject the changes.</para>
<code>[InfoPathEventHandler(MatchPath="/Customers/Customer/RepVisitDt", EventType=InfoPathEventType.<span class="label">OnBeforeChange</span>)]
public void RepVisitDt_<span class="label">OnBeforeChange</span>(DataDOMEvent e)
{
IXMLDOMNode phone = thisXDocument.DOM.selectSingleNode (@"/Customers/CustomerInfo/ContactDates/PhoneContactDt");
if (phone.text == "")
{
e.ReturnMessage = "The Phone Contact Start date must be set prior to the Representative Visit date.";
e.ReturnStatus = false;
return;
}
// If the data is valid, eventObj.ReturnStatus = true.
e.ReturnStatus = true;
return;
}</code>
</example>
</Docs>
</Member>
<Member MemberName="OnValidate">
<MemberSignature Language="C#" Value="event Microsoft.Office.Interop.InfoPath.SemiTrust._DataDOMEventSink_OnValidateEventHandler OnValidate;" />
<MemberSignature Language="ILAsm" Value=".event class Microsoft.Office.Interop.InfoPath.SemiTrust._DataDOMEventSink_OnValidateEventHandler OnValidate" />
<MemberSignature Language="DocId" Value="E:Microsoft.Office.Interop.InfoPath.SemiTrust._DataDOMEventSink_Event.OnValidate" />
<MemberSignature Language="VB.NET" Value="Event OnValidate As _DataDOMEventSink_OnValidateEventHandler " />
<MemberSignature Language="C++ CLI" Value="public:
 event Microsoft::Office::Interop::InfoPath::SemiTrust::_DataDOMEventSink_OnValidateEventHandler ^ OnValidate;" />
<MemberSignature Language="F#" Value="member this.OnValidate : Microsoft.Office.Interop.InfoPath.SemiTrust._DataDOMEventSink_OnValidateEventHandler " Usage="member this.OnValidate : Microsoft.Office.Interop.InfoPath.SemiTrust._DataDOMEventSink_OnValidateEventHandler " />
<MemberType>Event</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.Office.Interop.InfoPath.SemiTrust</AssemblyName>
<AssemblyVersion>11.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>Microsoft.Office.Interop.InfoPath.SemiTrust._DataDOMEventSink_OnValidateEventHandler</ReturnType>
</ReturnValue>
<Docs>
<summary>Occurs after changes to a form's underlying XML document have been accepted but before the <see cref="E:Microsoft.Office.Interop.InfoPath.SemiTrust._DataDOMEventSink_Event.OnAfterChange" /> event occurs.</summary>
<remarks>
<para>This event handler does not allow users to cancel an operation.</para>
<para>During the <b>OnValidate</b> event, the form's underlying XML document is placed in read-only mode.</para>
<para>The <b>OnValidate</b> event is typically used for handling errors and working with the <see cref="T:Microsoft.Office.Interop.InfoPath.SemiTrust.ErrorsCollection" /> collection — for example, adding new errors or deleting existing ones.</para>
<para>
<b>Note</b>: In some cases, events related to changes in a form's underlying XML document may occur more than once. For example, when existing data is changed, an insert and delete operation occurs.</para>
<para />
</remarks>
<example>
<para>In the following example, the <see cref="P:Microsoft.Office.Interop.InfoPath.SemiTrust.DataDOMEvent.Site" /> property of the <see cref="T:Microsoft.Office.Interop.InfoPath.SemiTrust.DataDOMEventObject" /> object is used to check the value of the node. If the data validation fails, the <see cref="M:Microsoft.Office.Interop.InfoPath.SemiTrust.DataDOMEvent.ReportError(System.Object,System.String,System.Boolean,System.String,System.Int32,System.String)" /> method is used to create a custom error:</para>
<code>[InfoPathEventHandler(MatchPath="/my:myFields/my:field1", EventType=InfoPathEventType.<span class="label">OnValidate</span>)]
public void field1_<span class="label">OnValidate</span>(DataDOMEvent e)
{
if (int.Parse(e.Site.text) &gt; 50)
{
e.ReportError(
e.Site,
"Invalid quantity. The total number of each type of block cannot exceed 50.",
false,
"",
2,
"modeless");
}
if (int.Parse(e.Site.text) &lt; 0)
{
e.ReportError(
e.Site,
"Invalid quantity. The total number of each type of block cannot be less than 0.",
false,
"",
2,
"modeless");
}
}</code>
</example>
<example>
<para>In the following example, the <see cref="P:Microsoft.Office.Interop.InfoPath.SemiTrust.DataDOMEvent.Site" /> property of the <see cref="T:Microsoft.Office.Interop.InfoPath.SemiTrust.DataDOMEventObject" /> object is used to check the value of the node. If the data validation fails, the <see cref="M:Microsoft.Office.Interop.InfoPath.SemiTrust.DataDOMEvent.ReportError(System.Object,System.String,System.Boolean,System.String,System.Int32,System.String)" /> method is used to create a custom error:</para>
<code>[InfoPathEventHandler(MatchPath="/my:myFields/my:field1", EventType=InfoPathEventType.<span class="label">OnValidate</span>)]
public void field1_<span class="label">OnValidate</span>(DataDOMEvent e)
{
if (int.Parse(e.Site.text) &gt; 50)
{
e.ReportError(
e.Site,
"Invalid quantity. The total number of each type of block cannot exceed 50.",
false,
"",
2,
"modeless");
}
if (int.Parse(e.Site.text) &lt; 0)
{
e.ReportError(
e.Site,
"Invalid quantity. The total number of each type of block cannot be less than 0.",
false,
"",
2,
"modeless");
}
}</code>
</example>
</Docs>
</Member>
</Members>
</Type>