private void btnStartPause_Clicked(object sender, EventArgs e) { Button bt = sender as Button; // Identifies the acion and frametimer by the button clicked TimerAction action = bt.Text == "Start" ? TimerAction.Start : (bt.Text == "Pause" ? TimerAction.Pause : TimerAction.Resume); bt.Text = bt.Text == "Start" ? "Pause" : (bt.Text == "Pause" ? "Resume" : "Pause"); FrameTimer fr = (bt == btnStartStopFTX1 ? frtTimer1 : (bt == btnStartStopFTX2 ? frtTimer2 : (bt == btnStartStopFTX3 ? frtTimer3 : (bt == btnStartStopFTX4 ? frtTimer4 : frtTimer5)))); // Call the apropriated method from the frametimer if (action == TimerAction.Start) { fr.Start(); } else if (action == TimerAction.Pause) { fr.Pause(); } else { fr.Resume(); } }
public void Pause( ) { timer.Pause(); }