Example #1
0
        /// <summary>
        ///   Calls <see cref="EventInfo.AddEventHandler(object, Delegate)"/>
        ///   on the original <see cref="EventInfo"/>.
        /// </summary>
        public void AddEventHandlerOriginal(object obj, Delegate handler)
        {
            if (AddRedirection == null)
            {
                throw new InvalidOperationException();
            }

            AddRedirection.InvokeOriginal(obj, handler);
        }
Example #2
0
        /// <summary>
        ///   Starts redirecting the <see langword="add"/>, <see langword="remove"/>, and
        ///   <see langword="raise"/> methods.
        /// </summary>
        public override void Start()
        {
            // Always stop them, because the user might have changed
            // their state individually
            AddRedirection?.Start();
            RemoveRedirection?.Start();
            RaiseRedirection?.Start();

            if (isRedirecting)
            {
                return;
            }

            isRedirecting = true;
        }
Example #3
0
 /// <inheritdoc />
 public override void Dispose()
 {
     AddRedirection?.Dispose();
     RemoveRedirection?.Dispose();
     RaiseRedirection?.Dispose();
 }