Пример #1
0
        /// <summary>
        /// Pauses the timer for the current player
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void TimerPauseButton_Click(object sender, EventArgs e)
        {
            switch (timerHelper)
            {
            case 1:
                P1Timer.Stop();
                TimerP1TextBox.BackColor  = Color.PaleVioletRed;
                TimerResumeButton.Visible = true;
                TimerPauseButton.Visible  = false;
                break;

            case 2:
                P2Timer.Stop();
                TimerP2TextBox.BackColor  = Color.PaleVioletRed;
                TimerResumeButton.Visible = true;
                TimerPauseButton.Visible  = false;
                break;

            case 3:
                P3Timer.Stop();
                TimerP3TextBox.BackColor  = Color.PaleVioletRed;
                TimerResumeButton.Visible = true;
                TimerPauseButton.Visible  = false;
                break;

            case 4:
                P4Timer.Stop();
                TimerP4TextBox.BackColor  = Color.PaleVioletRed;
                TimerResumeButton.Visible = true;
                TimerPauseButton.Visible  = false;
                break;

            case 5:
                P5Timer.Stop();
                TimerP5TextBox.BackColor  = Color.PaleVioletRed;
                TimerResumeButton.Visible = true;
                TimerPauseButton.Visible  = false;
                break;

            case 6:
                P6Timer.Stop();
                TimerP6TextBox.BackColor  = Color.PaleVioletRed;
                TimerResumeButton.Visible = true;
                TimerPauseButton.Visible  = false;
                break;

            case 7:
                P7Timer.Stop();
                TimerP7TextBox.BackColor  = Color.PaleVioletRed;
                TimerResumeButton.Visible = true;
                TimerPauseButton.Visible  = false;
                break;

            case 8:
                P8Timer.Stop();
                TimerP8TextBox.BackColor  = Color.PaleVioletRed;
                TimerResumeButton.Visible = true;
                TimerPauseButton.Visible  = false;
                break;

            default:
                break;
            }
        }
Пример #2
0
        /// <summary>
        /// Pauses the current player's time and starts the next player's timer
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void TimerNextPlayerButton_Click(object sender, EventArgs e)
        {
            TimerResumeButton.Visible = false;
            TimerPauseButton.Visible  = true;
            switch (timerHelper)
            {
            case 1:
                P1Timer.Stop();
                TimerP1TextBox.BackColor = Color.White;
                P2Timer.Start();
                TimerP2TextBox.BackColor = Color.LightGreen;
                timerHelper++;
                break;

            case 2:
                P2Timer.Stop();
                TimerP2TextBox.BackColor = Color.White;
                if (numPlayers > 2)
                {
                    P3Timer.Start();
                    TimerP3TextBox.BackColor = Color.LightGreen;
                    timerHelper++;
                }
                else
                {
                    P1Timer.Start();
                    TimerP1TextBox.BackColor = Color.LightGreen;
                    timerHelper = 1;
                }
                break;

            case 3:
                P3Timer.Stop();
                TimerP3TextBox.BackColor = Color.White;
                if (numPlayers > 3)
                {
                    P4Timer.Start();
                    TimerP4TextBox.BackColor = Color.LightGreen;
                    timerHelper++;
                }
                else
                {
                    P1Timer.Start();
                    TimerP1TextBox.BackColor = Color.LightGreen;
                    timerHelper = 1;
                }
                break;

            case 4:
                P4Timer.Stop();
                TimerP4TextBox.BackColor = Color.White;
                if (numPlayers > 4)
                {
                    P5Timer.Start();
                    TimerP5TextBox.BackColor = Color.LightGreen;
                    timerHelper++;
                }
                else
                {
                    P1Timer.Start();
                    TimerP1TextBox.BackColor = Color.LightGreen;
                    timerHelper = 1;
                }
                break;

            case 5:
                P5Timer.Stop();
                TimerP5TextBox.BackColor = Color.White;
                if (numPlayers > 5)
                {
                    P6Timer.Start();
                    TimerP6TextBox.BackColor = Color.LightGreen;
                    timerHelper++;
                }
                else
                {
                    P1Timer.Start();
                    TimerP1TextBox.BackColor = Color.LightGreen;
                    timerHelper = 1;
                }
                break;

            case 6:
                P6Timer.Stop();
                TimerP6TextBox.BackColor = Color.White;
                if (numPlayers > 6)
                {
                    P7Timer.Start();
                    TimerP7TextBox.BackColor = Color.LightGreen;
                    timerHelper++;
                }
                else
                {
                    P1Timer.Start();
                    TimerP1TextBox.BackColor = Color.LightGreen;
                    timerHelper = 1;
                }
                break;

            case 7:
                P7Timer.Stop();
                TimerP7TextBox.BackColor = Color.White;
                if (numPlayers > 7)
                {
                    P8Timer.Start();
                    TimerP8TextBox.BackColor = Color.LightGreen;
                    timerHelper++;
                }
                else
                {
                    P1Timer.Start();
                    TimerP1TextBox.BackColor = Color.LightGreen;
                    timerHelper = 1;
                }
                break;

            case 8:
                P8Timer.Stop();
                TimerP8TextBox.BackColor = Color.White;
                P1Timer.Start();
                TimerP1TextBox.BackColor = Color.LightGreen;
                timerHelper = 1;
                break;

            default:
                break;
            }
        }