/// <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); }
/// <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; }
/// <inheritdoc /> public override void Dispose() { AddRedirection?.Dispose(); RemoveRedirection?.Dispose(); RaiseRedirection?.Dispose(); }