コード例 #1
0
        /// <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;
            }
        }
コード例 #2
0
        /// <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();
        }