private void Form1_Load(object sender, EventArgs e) { StartTimeHours = 10; StartTimeMinutes = 0; FinishTimeHours = 24; FinishTimeMinutes = 0; WorkTime = 14 * 60; textBoxTimeDisplay.Text = WorkTime.ToString(); CurrentMovie = new Movie(); AllMovies = new List <Movie>(); }
private void textBoxFinishTime_TextChanged(object sender, EventArgs e) { if (textBoxFinishTime.Text.Length > 0) { double FinishTime = Convert.ToDouble(textBoxFinishTime.Text); FinishTimeHours = (int)Math.Floor(FinishTime); FinishTimeMinutes = (int)(FinishTime - FinishTimeHours); WorkTime = (FinishTimeHours - StartTimeHours) * 60 + (FinishTimeMinutes - StartTimeMinutes); textBoxTimeDisplay.Text = WorkTime.ToString(); } }
/// <summary> /// 创建WorkTime节点,属性为WorkTime的中文名 /// </summary> /// <param name="workTime"></param> /// <param name="workName"></param> /// <returns></returns> private static XElement CreateWorkTime(WorkTime workTime, WorkTimeCN workName) { XElement newWorkTime = new XElement("Root", new XElement(workTime.ToString(), new XAttribute("WorkName", workName.ToString()), CreateMonths().Elements() ) ); return newWorkTime; }
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(); }