private void AbortActionBTN_Click(object sender, EventArgs e) { GoBTN.Text = "Go"; AbortActionBTN.Enabled = false; GoBTN.Enabled = true; TypeOfAction.Enabled = true; dateTimePicker1.Enabled = true; TimerTo.Stop(); }
private void TimerTo_Tick(object sender, EventArgs e) { Remaining -= OneSecond; if (Remaining.TotalSeconds < 1) { TimerTo.Stop(); DoAction(); } GoBTN.Text = Remaining.ToString(); }
private void GoBTN_Click(object sender, EventArgs e) { TimeSpan s = TimeSpan.Parse(dateTimePicker1.Value.ToString("HH:mm:ss")); TimeSpan n = TimeSpan.Parse(DateTime.Now.ToString("HH:mm:ss")); Remaining = s - n; type = TypeOfAction.SelectedIndex; //Save Values Properties.Settings.Default.IndexOfAction = type; Properties.Settings.Default.LastTime = s; Properties.Settings.Default.Save(); //Check if time is negative if (Remaining.TotalSeconds < 0) { Remaining = TimeSpan.Parse("23:59:59") - Remaining.Duration(); } TypeOfAction.Enabled = false; AbortActionBTN.Enabled = true; GoBTN.Enabled = false; GoBTN.Text = Remaining.ToString(); dateTimePicker1.Enabled = false; TimerTo.Start(); }