Exemple #1
0
        /// <summary>
        /// Sends a notification synchronously.
        /// </summary>
        /// <param name="context">A reference to the condition context.</param>
        /// <param name="notification">The notification to send.</param>
        protected void SendNotification(IConditionContext context, INotification notification)
        {
            context.ThrowIfNull(nameof(context));
            notification.ThrowIfNull(nameof(notification));

            notification.Send(new NotificationContext(context.Logger, context.MapDescriptor, context.CreatureFinder));
        }
Exemple #2
0
        /// <summary>
        /// Sends a notification asynchronously.
        /// </summary>
        /// <param name="context">A reference to the condition context.</param>
        /// <param name="notification">The notification to send.</param>
        /// <param name="delayTime">Optional. The time delay after which the notification should be sent. If left null, the notificaion is scheduled to be sent ASAP.</param>
        protected void SendNotificationAsync(IConditionContext context, INotification notification, TimeSpan?delayTime = null)
        {
            context.ThrowIfNull(nameof(context));
            notification.ThrowIfNull(nameof(notification));

            context.Scheduler.ScheduleEvent(notification, delayTime);
        }