/// <summary> /// 提醒监视 /// </summary> private void ReminderMonitor() { _reportTimer = new Timer(new TimerCallback(callback => { try { foreach (var reminder in Reminders.ToArray()) { if (string.IsNullOrEmpty(reminder.Contact)) { TimeSpan date = DateTime.Now - (Convert.ToDateTime(reminder.ReminderTime)); if (date.TotalSeconds <= 10 && date.TotalSeconds >= 0) { ReminderRing(reminder); } } else { //todo:远程提醒 if (reminder.ReminderTime.Contains("每天")) { string week = "周一 周二 周三 周四 周五 周六 周日"; if (week.Contains(TodayWeek)) { MatchTime(reminder); } } else if (reminder.ReminderTime.Contains("工作日")) { string week = "周一 周二 周三 周四 周五"; if (week.Contains(TodayWeek)) { MatchTime(reminder); } } else if (reminder.ReminderTime.Contains("周末")) { string week = "周六 周日"; if (week.Contains(TodayWeek)) { MatchTime(reminder); } } else if (reminder.ReminderTime.Contains("只提醒一次")) { MatchTime(reminder); } else { if (reminder.ReminderTime.Contains(TodayWeek)) { MatchTime(reminder); } } } } } catch (Exception ex) { LogWriter.Instance.Error(ex); } }), null, 5, 10000); //一天执行一次=1000 * 60 * 60 * 24 }