public static void SendNotification(string message) { GetNotifications.Add(message); if (GetNotifications.Count > 20) { GetNotifications.RemoveAt(0); } }
public async void Run(IBackgroundTaskInstance taskInstance) { BackgroundTaskDeferral deferral = taskInstance.GetDeferral(); GetNotifications request = new GetNotifications(); IList <Notifications> notifications = await request.getNotifications(); if (notifications.Count > 0) { BuildNotifications(notifications); } deferral.Complete(); }
Task <IEnumerable <Notification> > IRequestHandler <GetNotifications, IEnumerable <Notification> > .Handle(GetNotifications request, CancellationToken cancellationToken) { return(autoTestContext.Notifications.Where(a => a.EventId == request.EventId).OrderByDescending(a => a.Created).ToEnumerableAsync(cancellationToken)); }