예제 #1
0
 /// <summary>
 /// Called when the bot is shutting down or restarting.
 /// </summary>
 private Task OnShuttingDownAsync(ShuttingDownEventArgs e)
 {
     shutdownMode = e.Mode;
     shutdownEvent.Set();
     return(Task.FromResult <object>(null));
 }
예제 #2
0
        public static async Task InvokeAsync(this AsyncEvent <ShuttingDownEventHandler> eventHandler, ShuttingDownEventArgs e)
        {
            var subscribers = eventHandler.Subscriptions;

            for (int i = 0; i < subscribers.Count; i++)
            {
                await subscribers[i].Invoke(e).ConfigureAwait(false);
            }
        }