private void OnTimerTick(object sender, EventArgs e) { if (AppData.PROPERTIES.Command != AppData.COMMAND.STOPWATCH) { AppData.TIME.Time = AppData.TIME.Time > 0 ? AppData.TIME.Time -= 1000 : 0; AppData.TIME.Used = AppData.TIME.Total - AppData.TIME.Time; AppData.TIME.Left = AppData.TIME.Time; AppData.TIME.Time = AppData.TIME.Time > 86400000 ? 86400000 : AppData.TIME.Time; if (AppData.TIME.Time <= 0) { OnTimeOver(AppData.PROPERTIES.Command); } } else { AppData.TIME.Time = AppData.TIME.Time < 86400000 ? AppData.TIME.Time += 1000 : 86400000; AppData.TIME.Used = AppData.TIME.Time; AppData.TIME.Left = 0; } Registry.SaveElapsedTime(Convert.ToString(AppData.TIME.Time)); TimerTxt.Invoke(new Action(() => TimerTxt.Text = DisplayTimeFormat(AppData.TIME.Time))); }
public void UpdateTimer(int time) { TimerTxt.SetText(time.ToString()); }