コード例 #1
0
        private void NextRoundCountdown(object sender, EventArgs e)
        {
            if (NextRoundCountdownCanRun)
            {
                int elapsedSeconds   = (int)(DateTime.Now - startTime).TotalSeconds;
                int remainingSeconds = NextRoundCoutdownTimer - elapsedSeconds;
                StatusLabel.Text = String.Format("Seconds left until next round: {0}", remainingSeconds);
                Player roundWinner = Client.RetrieveRoundWinner(CurrentRound);
                if (roundWinner != null)
                {
                    StatusLabel.Text += String.Format("  Round Winner: {0}!", roundWinner.Name);
                }
                else
                {
                    StatusLabel.Text += String.Format("  No winner this time!");
                }

                if (remainingSeconds <= 0)
                {
                    timer1.Stop();
                    UpdateGameInformation();
                    ShowQuestionInformation();
                    startTime = DateTime.Now;
                    QuestionCountdownCanRun  = true;
                    NextRoundCountdownCanRun = false;
                    timer1.Start();
                }
            }
        }