private void Timer_Start(object sender, EventArgs args) { if (InvokeRequired) { TimerStateChangeCallback callback = Timer_Start; Invoke(callback, this, args); } else { ModeTimer = TimerMode.Started; Settings.Default.ModeTimer = ModeTimer; Settings.Default.ModeFunction = ModeFunction; Settings.Default.StartTime = WorkTimer.StartTime; Settings.Default.Save(); TimerStartAdjustments(); Log.Info("WorkTimer has been started."); Log.Info($"Start date/time: {WorkTimer.StartTime}"); Log.Info($"Function mode : {ModeFunction}"); } }
private void Timer_Stop(object sender, EventArgs args) { if (InvokeRequired) { TimerStateChangeCallback callback = Timer_Stop; Invoke(callback, this, args); } else { ModeTimer = TimerMode.Stopped; ModeFunction = FunctionMode.Elapsed; //default function mode Settings.Default.ModeTimer = ModeTimer; Settings.Default.ModeFunction = ModeFunction; Settings.Default.StartTime = DateTime.MinValue; Settings.Default.PauseTime = TimeSpan.MinValue; Settings.Default.Save(); TimerStopAdjustments(); Log.Info("WorkTimer has been stopped."); } }
private void Timer_Pause(object sender, EventArgs args) { if (InvokeRequired) { TimerStateChangeCallback callback = Timer_Pause; Invoke(callback, this, args); } else { ModeTimer = TimerMode.Paused; Settings.Default.ModeTimer = ModeTimer; Settings.Default.ModeFunction = ModeFunction; Settings.Default.PauseTime = TimeSpan.Parse(TimerText.Text); Settings.Default.Save(); TimerPauseAdjustments(); Log.Info("WorkTimer has been paused."); Log.Info($"Start time: {WorkTimer.StartTime.TimeOfDay}"); Log.Info($"Pause time: {Settings.Default.PauseTime}"); Log.Info($"Function mode : {ModeFunction}"); } }