示例#1
0
 /// <summary>
 /// Fired before a property's get or set method is invoked.
 /// </summary>
 /// <param name="sender">
 /// The Mixin host container.
 /// </param>
 /// <param name="eventArgs">
 /// Contains references to the Target and Mixin class as well 
 /// as the property that is executing.
 /// </param>
 /// <remarks>
 /// Set the <see cref="MemberEventArgs.CancellationToken"/> to prevent
 /// the get or set method from invoking.
 /// </remarks>
 public virtual void OnBeforePropertyInvocation(object sender, PropertyEventArgs eventArgs)
 {
 }
示例#2
0
 /// <summary>
 /// Fired after a property's get or set method is invoked.
 /// </summary>
 /// <param name="sender">
 /// The Mixin host container.
 /// </param>
 /// <param name="eventArgs">
 /// Contains references to the Target and Mixin class as well
 /// as the property that is executing including the return value.
 /// </param>
 /// <remarks>
 /// Set the <see cref="MemberEventArgs.CancellationToken"/> to overwrite
 /// the return value.
 /// </remarks>
 public virtual void OnAfterPropertyInvocation(object sender, PropertyEventArgs eventArgs)
 {
 }
 public void OnBeforePropertyInvocation(object sender, PropertyEventArgs eventArgs)
 {
     if (eventArgs.IsGet)
         BeforePropertyGetInvocationCount++;
     else
         BeforePropertySetInvocationCount++;
 }
 public override void OnAfterPropertyInvocation(object sender, PropertyEventArgs eventArgs)
 {
     if (null != eventArgs.MemberInvocationException)
         eventArgs.CancellationToken = new CancellationToken
         {
             Cancel = true,
             ReturnValue = "Intercepted"
         };
 }
 public void OnAfterPropertyInvocation(object sender, PropertyEventArgs eventArgs)
 {
     if (eventArgs.IsGet)
         AfterPropertyGetInvocationCount++;
     else
         AfterPropertySetInvocationCount++;
 }