diff --git a/MovieQuiz/Controller/MainController.cs b/MovieQuiz/Controller/MainController.cs index 2f8da25..0ec1c2e 100644 --- a/MovieQuiz/Controller/MainController.cs +++ b/MovieQuiz/Controller/MainController.cs @@ -130,11 +130,8 @@ public void OnPlayerStateChange(int NewState) public void OnTimerTick(object sender, EventArgs e) { timeleft--; - if (timeleft > 0) - { - view.ShowRemainingTime(timeleft); - } - else + view.ShowRemainingTime(timeleft); + if (timeleft <= 0) { timer.Stop(); view.ShowTimeout(quiz.Score); diff --git a/MovieQuiz/Views/QuestionView.Designer.cs b/MovieQuiz/Views/QuestionView.Designer.cs index aa78cc5..eeb0a34 100644 --- a/MovieQuiz/Views/QuestionView.Designer.cs +++ b/MovieQuiz/Views/QuestionView.Designer.cs @@ -32,6 +32,7 @@ private void InitializeComponent() this.playButton = new System.Windows.Forms.PictureBox(); this.panel1 = new System.Windows.Forms.Panel(); this.answerPanel = new System.Windows.Forms.Panel(); + this.timeoutLabel = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.playButton)).BeginInit(); this.panel1.SuspendLayout(); this.SuspendLayout(); @@ -60,6 +61,7 @@ private void InitializeComponent() // // panel1 // + this.panel1.Controls.Add(this.timeoutLabel); this.panel1.Controls.Add(this.answerPanel); this.panel1.Controls.Add(this.playButton); this.panel1.Controls.Add(this.label1); @@ -77,6 +79,17 @@ private void InitializeComponent() this.answerPanel.Size = new System.Drawing.Size(264, 146); this.answerPanel.TabIndex = 5; // + // timeoutLabel + // + this.timeoutLabel.Anchor = System.Windows.Forms.AnchorStyles.None; + this.timeoutLabel.AutoSize = true; + this.timeoutLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 26F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.timeoutLabel.Location = new System.Drawing.Point(241, 111); + this.timeoutLabel.Name = "timeoutLabel"; + this.timeoutLabel.Size = new System.Drawing.Size(37, 39); + this.timeoutLabel.TabIndex = 6; + this.timeoutLabel.Text = "0"; + // // QuestionView // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -97,5 +110,6 @@ private void InitializeComponent() private System.Windows.Forms.PictureBox playButton; private System.Windows.Forms.Panel panel1; private System.Windows.Forms.Panel answerPanel; + private System.Windows.Forms.Label timeoutLabel; } } diff --git a/MovieQuiz/Views/QuestionView.cs b/MovieQuiz/Views/QuestionView.cs index 06d23f9..bcacdce 100644 --- a/MovieQuiz/Views/QuestionView.cs +++ b/MovieQuiz/Views/QuestionView.cs @@ -38,6 +38,8 @@ internal void SetQuestion(List answers, int questionNumber, int question button.Click += onButtonClicked; answerPanel.Controls.Add(button); } + + this.timeoutLabel.Text = String.Empty; } private void onButtonClicked(object sender, EventArgs e) @@ -48,7 +50,7 @@ private void onButtonClicked(object sender, EventArgs e) internal void ShowRemainingTime(int seconds) { - // TODO + this.timeoutLabel.Text = seconds.ToString(); } } }