private void SetAlarmTimer() { _AlarmTimer.Stop(); _AlarmTimer.ClearJobs(); _AlarmTimer.AddJob(AlarmTime, new TickHandler(_AlarmTimer_Elapsed)); _AlarmTimer.Start(); }
private void Form1_Load(object sender, EventArgs e) { var Timer = new ScheduleTimer(); Timer.Elapsed += new ScheduledEventHandler(timer_Elapsed); Timer.AddEvent(new Schedule.ScheduledTime("BySecond", "5")); Timer.Start(); }
private void SetTickTimer() { StrTime = DateTime.Now.ToString("T"); _TickTimer.AddJob( new Schedule.ScheduledTime(EventTimeIntervalEnum.BySecond, TimeSpan.Zero), new TickHandler(_TickTimer_Elapsed) ); _TickTimer.Start(); }
private static void MultipleJobTimer() { DateTime now = DateTime.Now; Delegate d = new dOutput(Output); IScheduledItem item; // item = new SimpleInterval(now, new TimeSpan(0, 0, 1)); // _Timer.AddJob(item, d, "error"); item = new SimpleInterval(now, new TimeSpan(0, 0, 3)); _Timer.AddJob(item, d, "three"); item = new SimpleInterval(now, new TimeSpan(0, 0, 2)); _Timer.AddJob(item, d, "two"); _Timer.Error += new ExceptionEventHandler(_Timer_Error); _Timer.Start(); }
void SetTickTimer() { sDateTime = DateTime.Now.ToString("T"); _TickTimer.AddJob( new ScheduledTime(EventTime.BySecond, TimeSpan.Zero), new TickHandler(TickTimer_Elapsed) ); _TickTimer.Start(); }
static void MultipleJobTimer() { var dtNow = DateTime.Now; var func = new OrderedOutput(Output); SimpleInterval item; //item = new SimpleInterval(dtNow, new TimeSpan(0, 0, 1)); //_Timer.AddJob(item, func, "error"); item = new SimpleInterval(dtNow, new TimeSpan(0, 0, 3)); Timer.AddJob(item, func, "three"); item = new SimpleInterval(dtNow, new TimeSpan(0, 0, 2)); Timer.AddJob(item, func, "two"); Timer.Error += Timer_Error; Timer.Start(); }
void ItmAlarm_Click(object sender, EventArgs e) { try { _AlarmDialog.SetSchedule(GetSetting("alarm", "Daily|4:30 PM")); if (_AlarmDialog.ShowDialog(this) == DialogResult.OK) { IScheduledItem Item = _AlarmDialog.GetSchedule(); SetSetting("alarm", _AlarmDialog.GetScheduleString()); _AlarmTimer.Stop(); _AlarmTimer.ClearJobs(); _AlarmTimer.AddJob(Item, new TickHandler(AlarmTimer_Elapsed)); _AlarmTimer.Start(); } } catch (Exception ex) { Startup.HandleException(ex); } }
protected override void OnStart(string[] args) { try { System.Diagnostics.Debugger.Launch(); ScheduleTimer Timer = new ScheduleTimer(); Timer.Elapsed += Timer_Elapsed; Timer.AddEvent(new ScheduledTime("Daily", AppSettingHelper.DailyJobTime)); Timer.Start(); } catch (Exception e) { } }
protected override void OnEnabling(EnablingEventArgs e) { tickTimer = new ScheduleTimer(); tickTimer.Elapsed += AlarmHit; if (recurDaily) { tickTimer.AddEvent(new Schedule.ScheduledTime(EventTimeBase.Daily, new TimeSpan(0, hour, minute, second, 0))); } else { alarmTime = new DateTime(year, month, day, hour, minute, second); SingleEvent se = new SingleEvent(alarmTime); tickTimer.AddEvent(se); } tickTimer.Start(); }
private void button1_Click(object sender, System.EventArgs e) { timer.Start(); }
private static void MonitorThemeChanges() { #if UNITY_EDITOR_WIN registryMonitor?.Stop(); #elif UNITY_EDITOR_OSX appearanceMonitor?.Stop(); #endif timer?.Stop(); if (UserPreferences.IsEnabled) { if (UserPreferences.Mode == UserPreferences.AutoThemeMode.System) { #if UNITY_EDITOR_WIN // Windows: Watch system theme changes in registry registryMonitor = new RegistryMonitor(RegistryHive.CurrentUser, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize"); registryMonitor.RegChanged += (sender, args) => SetEditorThemeFromSystemTheme(); registryMonitor.Start(); #elif UNITY_EDITOR_OSX // macOS appearanceMonitor = new AppearanceMonitor(); appearanceMonitor.AppearanceChanged += (sender, args) => { SetEditorThemeFromSystemTheme(); }; appearanceMonitor.Start(); #endif // Set current system theme on start/when enabled SetEditorThemeFromSystemTheme(); } else if (UserPreferences.Mode == UserPreferences.AutoThemeMode.Time) { var now = DateTime.Now.TimeOfDay; // Check current time and set theme if (UserPreferences.LightThemeTime < UserPreferences.DarkThemeTime) { if (now >= UserPreferences.LightThemeTime && now < UserPreferences.DarkThemeTime) { EditorThemeChanger.SetLightTheme(); } else { EditorThemeChanger.SetDarkTheme(); } } else { if (now < UserPreferences.LightThemeTime && now >= UserPreferences.DarkThemeTime) { EditorThemeChanger.SetDarkTheme(); } else { EditorThemeChanger.SetLightTheme(); } } // Schedule theme changes var lightThemeSchedule = new ScheduledTime(EventTimeBase.Daily, UserPreferences.LightThemeTime); var darkThemeSchedule = new ScheduledTime(EventTimeBase.Daily, UserPreferences.DarkThemeTime); timer = new ScheduleTimer(); timer.AddJob(lightThemeSchedule, new Action(EditorThemeChanger.SetLightTheme)); timer.AddJob(darkThemeSchedule, new Action(EditorThemeChanger.SetDarkTheme)); timer.Start(); } } }