예제 #1
0
        public static async Task InvokeAsync <T1, T2, T3, T4, T5>(this AsyncEvent <Func <T1, T2, T3, T4, T5, Task> > eventHandler, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5)
        {
            var subscribers = eventHandler.Subscriptions;

            for (int i = 0; i < subscribers.Count; i++)
            {
                await subscribers[i].Invoke(arg1, arg2, arg3, arg4, arg5).ConfigureAwait(false);
            }
        }
예제 #2
0
        public static async Task InvokeAsync <T>(this AsyncEvent <Func <T, Task> > eventHandler, T arg)
        {
            var subscribers = eventHandler.Subscriptions;

            for (int i = 0; i < subscribers.Count; i++)
            {
                await subscribers[i].Invoke(arg).ConfigureAwait(false);
            }
        }
예제 #3
0
        public static async Task InvokeAsync(this AsyncEvent <Func <Task> > eventHandler)
        {
            IReadOnlyList <Func <Task> > subscribers = eventHandler.Subscriptions;

            for (int i = 0; i < subscribers.Count; i++)
            {
                await subscribers[i].Invoke().ConfigureAwait(false);
            }
        }
예제 #4
0
        public static async Task InvokeAsync <T1, T2, T3>(this AsyncEvent <Func <T1, T2, T3, Task> > eventHandler, T1 arg1, T2 arg2, T3 arg3)
        {
            IReadOnlyList <Func <T1, T2, T3, Task> > subscribers = eventHandler.Subscriptions;

            for (int i = 0; i < subscribers.Count; i++)
            {
                await subscribers[i].Invoke(arg1, arg2, arg3).ConfigureAwait(false);
            }
        }
예제 #5
0
        public static async Task InvokeAsync <T1, T2, T3>(this AsyncEvent <Func <T1, T2, T3, Task> > eventHandler, T1 arg1, T2 arg2, T3 arg3)
        {
            var subscribers = eventHandler.Subscriptions;

            if (subscribers.Count > 0)
            {
                List <Task> tasks = new List <Task>();
                for (int i = 0; i < subscribers.Count; i++)
                {
                    tasks.Add(subscribers[i].Invoke(arg1, arg2, arg3));
                }

                await Task.WhenAll(tasks).ConfigureAwait(false);
            }
        }