/// <summary> /// Event handler for pressing the top button /// </summary> /// <param name="sender">the top button</param> /// <param name="e">mouse button event args</param> private void OnPressTopButton(object sender, MouseButtonEventArgs e) { PressTopButton.Begin(); Rectangle rect = sender as Rectangle; this.topButtonPressed = rect.CaptureMouse(); switch (this.chronographState) { case 0: // Stopped StartChronograph.Begin(); this.chronographState = 1; break; case 1: // Running StartChronograph.Pause(); this.chronographState = 2; break; case 2: // Paused StartChronograph.Resume(); this.chronographState = 1; break; } }
/// <summary> /// Press the bottom button /// </summary> /// <param name="sender">bottom button</param> /// <param name="e">mouse button event args</param> private void OnPressBottomButton(object sender, MouseButtonEventArgs e) { PressBottomButton.Begin(); StartChronograph.Stop(); this.chronographState = 0; var rectangle = sender as Rectangle; this.bottomButtonPressed = rectangle.CaptureMouse(); }