/// <summary> /// Geeft score/doet dingen als het antwoord correct is. /// </summary> private void CorrectAnswer(PictureBox pb, Image img) { if (dmxcon.dmx.IsOpen) { dmxeffects.correctanswer(4, LightFixt(), "on"); } MethodInvoker Label = delegate { GameManager.Score += 400; VraagLabel.Text = "Correct! + 200 score"; VraagLabel.ForeColor = Green; pb.Image = img; }; Invoke(Label); Thread.Sleep(1000); if (dmxcon.dmx.IsOpen) { dmxeffects.correctanswer(4, LightFixt(), "off"); } MethodInvoker Next = delegate { TriviaInitialize(); }; Invoke(Next); MethodInvoker Label2 = delegate { VraagLabel.Text = Question[0].ToUpper(); VraagLabel.ForeColor = Yellow; }; Invoke(Label2); if (answeredquestions < 3) { return; } MethodInvoker Control = delegate { w5.CancelAsync(); w7.CancelAsync(); Controller.DisconnectGamepad(); ControlScherm obj = new ControlScherm(); Hide(); obj.Closed += (s, args) => Close(); obj.Show(); }; Invoke(Control); }
//Refresh Button Control Scherm Only private void Refresh_Click(object sender, MouseEventArgs e) { AntiDouble = true; Controller.DisconnectGamepad(); //Disconnect Gamepad Thread Socket.DisconnectStream(); //Disconnect van Socket Stream ControlScherm obj = new ControlScherm(); Hide(); obj.Closed += (s, args) => Close(); obj.Show(); }
/// <summary> /// Invoke New Form, dit is nodig omdat deze method gecalled wordt vanuit de Gamepad thread. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void StartButton_Click(object sender, MouseEventArgs e) { GameManager.Score = 1000; GameManager.Time = 0; GameManager.Fouten = 0; Trivia.Bombs[0] = false; Trivia.Bombs[1] = false; Trivia.Bombs[2] = false; MethodInvoker startForm = delegate { w1.CancelAsync(); //Kill Gamepad Listener Backgroundworker Controller.DisconnectGamepad(); //Kill Gamepad Backgroundworker ControlScherm obj = new ControlScherm(); Hide(); obj.Closed += (s, args) => Close(); obj.Show(); }; Invoke(startForm); }