private static void Timer_Tick(object sender) { if (!RestTime.Equals(DateTime.MinValue)) { RestTime = RestTime.AddSeconds(-1); bind.TxtTimer = RestTime.ToString(@"mm\:ss"); } }
protected override void OnCallBacking() { Pause = !Pause; if (Pause) { if (MessageBox.Show(Program.frmMain, "重新设置番茄", "重置确认", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.OK) { try { RestTime = Convert.ToInt32(InputBox.ShowInputBox("重置", "休息时间", RestTime.ToString())); WorkTime = Convert.ToInt32(InputBox.ShowInputBox("重置", "工作时间", WorkTime.ToString())); pauseTimeLeft = targetNowTime = (float)Convert.ToDouble(InputBox.ShowInputBox("重置", "当前时间", targetNowTime.ToString())); nowRoundIndex = 1; } catch (Exception ex) { MessageBox.Show(ex.Message); } Pause = true; } } base.OnCallBacking(); }