Esempio n. 1
0
        private static DateTimeOffset GetLastCheckedDate(NotificationData notificationData)
        {
            var oneDayAgo = DateTimeOffset.Now.AddDays(-1);

            if (notificationData == null ||
                notificationData.LastNotificationDate < oneDayAgo)
            {
                return(oneDayAgo);
            }
            else
            {
                return(notificationData.LastNotificationDate);
            }
        }
Esempio n. 2
0
        public async Task StartAsync(string projectKey, NotificationData notificationData)
        {
            if (projectKey == null)
            {
                throw new ArgumentNullException(nameof(projectKey));
            }

            this.projectKey = projectKey;
            cancellation    = new CancellationTokenSource();
            Model.AreNotificationsEnabled = notificationData?.IsEnabled ?? true;
            lastCheckDate = GetLastCheckedDate(notificationData);

            timer.Start();
            await UpdateEvents(true);
        }