/// <summary> /// Method invoked when the event to which the current aspect is applied is fired, <i>for each</i> delegate /// of this event, and <i>instead of</i> invoking this delegate. /// </summary> /// <param name="args">Handler arguments.</param> public override void OnInvokeHandler(EventInterceptionArgs args) { Console.WriteLine(string.Format("Event {0} invoked.", args.Event.Name)); //If ProceedInvokeHandler is not called the handler that //was supposed to be invoked will never get invoked. args.ProceedInvokeHandler(); }
public override void OnInvokeHandler(EventInterceptionArgs args) { int x = 0; if (x > 0) //Do you logic here { args.ProceedInvokeHandler(); } }
private static void Invoke(EventInterceptionArgs args) { try { args.ProceedInvokeHandler(); } catch (Exception e) { Trace.TraceError(e.ToString()); args.ProceedRemoveHandler(); } }
public override void OnInvokeHandler( EventInterceptionArgs args ) { ThreadPool.QueueUserWorkItem( state => { try { args.ProceedInvokeHandler(); } catch { args.ProceedRemoveHandler(); } } ); }
public override void OnInvokeHandler(EventInterceptionArgs args) { ThreadPool.QueueUserWorkItem(state => { try { args.ProceedInvokeHandler(); } catch { args.ProceedRemoveHandler(); } }); }
public override void OnInvokeHandler(EventInterceptionArgs args) { DispatcherObject dispatcherObject = args.Handler.Target as DispatcherObject; if (dispatcherObject == null || dispatcherObject.CheckAccess()) { args.ProceedInvokeHandler(); } else { // We have to dispatch synchronously to avoid the object to be changed // before the time the event is raised and the time it is processed. dispatcherObject.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(args.ProceedInvokeHandler)); } }
public override void OnInvokeHandler( EventInterceptionArgs args ) { DispatcherObject dispatcherObject = args.Handler.Target as DispatcherObject; if ( dispatcherObject == null || dispatcherObject.CheckAccess() ) { args.ProceedInvokeHandler(); } else { // We have to dispatch synchronously to avoid the object to be changed // before the time the event is raised and the time it is processed. dispatcherObject.Dispatcher.Invoke( DispatcherPriority.Normal, new Action( args.ProceedInvokeHandler ) ); } }
public void OnInvoke(EventInterceptionArgs args) { ReaderWriterLockSlim @lock = ((IReaderWriterSynchronized)args.Instance).Lock; bool reEnterWriteLock = @lock.IsWriteLockHeld; this.Enter(@lock); try { args.ProceedInvokeHandler(); } finally { this.Exit(reEnterWriteLock, @lock); } }
public void OnInvoke( EventInterceptionArgs args ) { ReaderWriterLockSlim @lock = ((IReaderWriterSynchronized)args.Instance).Lock; bool reEnterWriteLock = @lock.IsWriteLockHeld; this.Enter( @lock ); try { args.ProceedInvokeHandler(); } finally { this.Exit( reEnterWriteLock, @lock ); } }
public override void OnInvokeHandler(EventInterceptionArgs args) { Console.WriteLine("Event Invoke Edildi"); args.ProceedInvokeHandler(); }
public override void OnInvokeHandler(EventInterceptionArgs args) { Console.WriteLine("Event {0} invoked", args.Event.Name); args.ProceedInvokeHandler(); }