Ejemplo n.º 1
0
 public Tasks()
 {
     InitializeComponent();
     checkBtn.Click  += delegate { QuestionAnswered?.Invoke(this, EventArgs.Empty); };
     Load            += delegate { TestOpen?.Invoke(this, EventArgs.Empty); };
     checkBtn.Enabled = false;
 }
Ejemplo n.º 2
0
        public async void CheckAnswer(SocketMessage rawMessage)
        {
            // If we arn't running, don't bother checking
            if (!IsRunning)
            {
                return;
            }

            // If we've gotten this far, our message is almost definitely an attempt at a 1-4 answer.
            // Figure out if the user has already tried to answer this question
            if (hasAnsweredCurrentQuestion.ContainsKey(rawMessage.Author.Id))
            {
                return;
            }
            else
            {
                hasAnsweredCurrentQuestion.Add(rawMessage.Author.Id, true);
            }

            // Figure out if they answered correctly.
            // Since our answer indexes are 0-3, just add 1 to get the corrisponding answer attempt
            if (rawMessage.Content == (questionSetManager.CurrentQuestion.AnswerNumber + 1).ToString())
            {
                hasAnsweredCurrentQuestion.Clear();
                QuestionAnswered?.Invoke(this, new QuestionAnsweredEventArgs(questionSetManager.CurrentQuestion, rawMessage.Author));
                // Give them a point
                scoreKeeper.AddScore(rawMessage.Author, 1);
                // And ask the next question
                GetNextQuestion();
            }
        }
Ejemplo n.º 3
0
 protected void OnQuestionAnswered(string playerName, bool correctAnswer)
 {
     QuestionAnswered?.Invoke(this, new QuestionAnsweredEventArgs
     {
         PlayerName    = playerName,
         CorrectAnswer = correctAnswer,
     });
 }
Ejemplo n.º 4
0
 private void _view_QuestionAnswered(object sender, EventArgs e)
 {
     QuestionAnswered.Invoke(this, null);
 }
Ejemplo n.º 5
0
 public void HandleAnswer(Response answer, Action callback, string lastQuestionKey)
 {
     QuestionAnswered?.Invoke(this, new QuestionAnsweredEventArgs(answer, callback, lastQuestionKey));
 }