<PackageReference Include="Nito.AsyncEx.Tasks" Version="5.1.1" />

Nito.AsyncEx.Interop.EventAsyncFactory

public static class EventAsyncFactory
Creation methods for tasks wrapping events.
namespace Nito.AsyncEx.Interop { public static class EventAsyncFactory { public static Task<TEventArguments> FromAnyEvent<[System.Runtime.CompilerServices.Nullable(2)] TDelegate, [System.Runtime.CompilerServices.Nullable(2)] TEventArguments>(Func<Action<TEventArguments>, TDelegate> convert, Action<TDelegate> subscribe, Action<TDelegate> unsubscribe, CancellationToken cancellationToken, bool unsubscribeOnCapturedContext); public static Task<TEventArguments> FromAnyEvent<[System.Runtime.CompilerServices.Nullable(2)] TDelegate, [System.Runtime.CompilerServices.Nullable(2)] TEventArguments>(Func<Action<TEventArguments>, TDelegate> convert, Action<TDelegate> subscribe, Action<TDelegate> unsubscribe, CancellationToken cancellationToken); public static Task<TEventArguments> FromAnyEvent<[System.Runtime.CompilerServices.Nullable(2)] TDelegate, [System.Runtime.CompilerServices.Nullable(2)] TEventArguments>(Func<Action<TEventArguments>, TDelegate> convert, Action<TDelegate> subscribe, Action<TDelegate> unsubscribe); public static Task<EventArguments<object, EventArgs>> FromEvent(Action<EventHandler> subscribe, Action<EventHandler> unsubscribe, CancellationToken cancellationToken, bool unsubscribeOnCapturedContext); public static Task<EventArguments<object, EventArgs>> FromEvent(Action<EventHandler> subscribe, Action<EventHandler> unsubscribe, CancellationToken cancellationToken); public static Task<EventArguments<object, EventArgs>> FromEvent(Action<EventHandler> subscribe, Action<EventHandler> unsubscribe); public static Task<EventArguments<object, TEventArgs>> FromEvent<[System.Runtime.CompilerServices.Nullable(2)] TEventArgs>(Action<EventHandler<TEventArgs>> subscribe, Action<EventHandler<TEventArgs>> unsubscribe, CancellationToken cancellationToken, bool unsubscribeOnCapturedContext); public static Task<EventArguments<object, TEventArgs>> FromEvent<[System.Runtime.CompilerServices.Nullable(2)] TEventArgs>(Action<EventHandler<TEventArgs>> subscribe, Action<EventHandler<TEventArgs>> unsubscribe, CancellationToken cancellationToken); public static Task<EventArguments<object, TEventArgs>> FromEvent<[System.Runtime.CompilerServices.Nullable(2)] TEventArgs>(Action<EventHandler<TEventArgs>> subscribe, Action<EventHandler<TEventArgs>> unsubscribe); public static Task<EventArguments<object, TEventArgs>> FromEvent<[System.Runtime.CompilerServices.Nullable(2)] TDelegate, [System.Runtime.CompilerServices.Nullable(2)] TEventArgs>(Func<EventHandler<TEventArgs>, TDelegate> convert, Action<TDelegate> subscribe, Action<TDelegate> unsubscribe, CancellationToken cancellationToken, bool unsubscribeOnCapturedContext); public static Task<EventArguments<object, TEventArgs>> FromEvent<[System.Runtime.CompilerServices.Nullable(2)] TDelegate, [System.Runtime.CompilerServices.Nullable(2)] TEventArgs>(Func<EventHandler<TEventArgs>, TDelegate> convert, Action<TDelegate> subscribe, Action<TDelegate> unsubscribe, CancellationToken cancellationToken); public static Task<EventArguments<object, TEventArgs>> FromEvent<[System.Runtime.CompilerServices.Nullable(2)] TDelegate, [System.Runtime.CompilerServices.Nullable(2)] TEventArgs>(Func<EventHandler<TEventArgs>, TDelegate> convert, Action<TDelegate> subscribe, Action<TDelegate> unsubscribe); public static Task<EventArguments<TSender, TEventArgs>> FromActionEvent<[System.Runtime.CompilerServices.Nullable(2)] TSender, [System.Runtime.CompilerServices.Nullable(2)] TEventArgs>(Action<Action<TSender, TEventArgs>> subscribe, Action<Action<TSender, TEventArgs>> unsubscribe, CancellationToken cancellationToken, bool unsubscribeOnCapturedContext); public static Task<EventArguments<TSender, TEventArgs>> FromActionEvent<[System.Runtime.CompilerServices.Nullable(2)] TSender, [System.Runtime.CompilerServices.Nullable(2)] TEventArgs>(Action<Action<TSender, TEventArgs>> subscribe, Action<Action<TSender, TEventArgs>> unsubscribe, CancellationToken cancellationToken); public static Task<EventArguments<TSender, TEventArgs>> FromActionEvent<[System.Runtime.CompilerServices.Nullable(2)] TSender, [System.Runtime.CompilerServices.Nullable(2)] TEventArgs>(Action<Action<TSender, TEventArgs>> subscribe, Action<Action<TSender, TEventArgs>> unsubscribe); public static Task<TEventArgs> FromActionEvent<[System.Runtime.CompilerServices.Nullable(2)] TEventArgs>(Action<Action<TEventArgs>> subscribe, Action<Action<TEventArgs>> unsubscribe, CancellationToken cancellationToken, bool unsubscribeOnCapturedContext); public static Task<TEventArgs> FromActionEvent<[System.Runtime.CompilerServices.Nullable(2)] TEventArgs>(Action<Action<TEventArgs>> subscribe, Action<Action<TEventArgs>> unsubscribe, CancellationToken cancellationToken); public static Task<TEventArgs> FromActionEvent<[System.Runtime.CompilerServices.Nullable(2)] TEventArgs>(Action<Action<TEventArgs>> subscribe, Action<Action<TEventArgs>> unsubscribe); public static Task FromActionEvent(Action<Action> subscribe, Action<Action> unsubscribe, CancellationToken cancellationToken, bool unsubscribeOnCapturedContext); public static Task FromActionEvent(Action<Action> subscribe, Action<Action> unsubscribe, CancellationToken cancellationToken); public static Task FromActionEvent(Action<Action> subscribe, Action<Action> unsubscribe); } }