private void PopReminderWindow(DateTime now) { var todayEvents = DatabaseManager.GetEventsForTheDay(now); ReminderWindow reminder = new ReminderWindow(todayEvents.ToList(), (hoursWhenToRemind.Last() > now.Hour) && (todayEvents.ToList().Count > 0)); switch (reminder.ShowDialog()) { case true: lastDateConfirmed = now; lastHourWhenReminded = 25; List <Events> eventsToDelete = new List <Events>(); foreach (Events e in todayEvents) { if (!e.Annually) { eventsToDelete.Add(e); } } DatabaseManager.RemoveEvent(eventsToDelete); break; case false: default: lastHourWhenReminded = now.Hour; break; } }
private void ReminderTrigger() { FileWithReminders f = new FileWithReminders(); List <ReminderElement> lr; DispatcherTimer timer = new DispatcherTimer(new TimeSpan(0, 0, 1), DispatcherPriority.Normal, delegate { lr = f.readRemindersFromFile(); foreach (ReminderElement r in lr) { if (DateTime.Now.ToString() == r.time) { ReminderWindow rw = new ReminderWindow(r.content); rw.Show(); } } }, Dispatcher); }