private void TimerAlert_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { try { string DayPart = System.DateTime.Now.DayOfWeek.ToString().Substring(0, 3); if (int.Parse(System.DateTime.Now.Hour.ToString()) >= int.Parse(Settings.GetValue("ScheduleTime").ToString()) && int.Parse(System.DateTime.Now.Hour.ToString()) <= int.Parse(Settings.GetValue("ScheduleEndTime").ToString())) { String[] scheduledDays = ((String)Settings.GetValue("ScheduleDay").ToString()).Split(','); //if (DayPart.ToUpper() == Settings.GetValue("ScheduleDay").ToString() || "ALL" == Settings.GetValue("ScheduleDay").ToString()) if (scheduledDays.Contains(DayPart)) { TimerAlert.Enabled = false; LogFile(Application.StartupPath + "\\SchedulerLog.txt", "Tick"); AdiScheduler a = new AdiScheduler(); a.Process(); TimerAlert.Enabled = true; } } } catch (Exception ex) { TimerAlert.Enabled = true; LogFile(Application.StartupPath + "\\SchedulerLog.txt", ex.ToString()); } }