public Form1() { InitializeComponent(); kits[0] = new TimerKits(titleText, timeText, rapTimesText, stopTimerButton, resetButton, groupBox1, timer1); kits[1] = new TimerKits(titleText2, timeText2, rapTimesText2, stopTimerButton2, resetButton2, groupBox2, timer2); kits[2] = new TimerKits(titleText3, timeText3, rapTimesText3, stopTimerButton3, resetButton3, groupBox3, timer3); kits[3] = new TimerKits(titleText4, timeText4, rapTimesText4, stopTimerButton4, resetButton4, groupBox4, timer4); kits[4] = new TimerKits(titleText5, timeText5, rapTimesText5, stopTimerButton5, resetButton5, groupBox5, timer5); }
private TimerKits findTimerKitsReset(object sender) { TimerKits tk = null; foreach (TimerKits t in kits) { if (t.searchTimerReset((Button)sender)) { tk = t; } } return(tk); }
private TimerKits findTimerKitsTimer(object sender) { TimerKits tk = null; foreach (TimerKits t in kits) { if (t.searchTimerTimer((Timer)sender)) { tk = t; } } return(tk); }
private void stopTimerButton_click(object sender, EventArgs e) { TimerKits tk = findTimerKitsButton(sender); if (tk.State == TimerKits.STOP_STATE) { stopEnableTimer(); tk.start(); } else if (tk.State == TimerKits.START_STATE) { tk.stop(); } }
private void resetButton_Click(object sender, EventArgs e) { TimerKits tk = findTimerKitsReset(sender); tk.reset(); }