public void AskScpecifiedQuestion(QuizObject inQuizObject) { CurrentQuizObject = inQuizObject; mQuizHint = new QuizHint(CurrentQuizObject.Answer); mTimeToGiveAHint.Enabled = true; TimeTillNextQuestion = TimeBetweenQuestions / 1000; mTimeTillNextQuestion.Enabled = true; //SendMessage(new IrcCommand(null,"PRIVMSG", new IrcCommandParameter("#sovietmade",false), new IrcCommandParameter(mCurrentQAPair.Item1,true)).ToString() + "\r\n"); SendMessage(CurrentQuizObject.Question); }
async void OnTimeToAskAQuestion(object source, ElapsedEventArgs e) { mTimeToGiveAHint.Stop(); mTimeToAskAQuestion.Stop(); mTimeTillNextQuestion.Stop(); //if there is no more items in Q, then the exception will be rised if (mQuizList.Count == 0) { return; } if (ctsDelay != null) { ctsDelay.Cancel(); } ctsDelay = new CancellationTokenSource(); if (mCurrentObject != null && mCurrentObject.IsAnswered() == false) { string message = String.Format("The answer was: {0}!", mCurrentObject.Answer); mCurrentObject.SetAnswered(true); SendMessage(message); if (mCurrentObject.IsImageQuestion()) { mCurrentObject.UncoverFullImage(); ShowStaff(mCurrentObject.GetImageQuestion()); } } CurrentQuizObject = GetQuizObject(); if (CurrentQuizObject == null) { InternalInitiationQuizStop(); return; } mQuizHint = new QuizHint(CurrentQuizObject.Answer); TimeTillNextQuestion = TimeBetweenQuestions / 1000; await DelayExecution(ctsDelay.Token); if (mCurrentObject == null || cts == null || !quizIsRunning) { return; } mTimeToGiveAHint.Start(); mTimeToAskAQuestion.Start(); mTimeTillNextQuestion.Start(); //SendMessage(new IrcCommand(null,"PRIVMSG", new IrcCommandParameter("#sovietmade",false), new IrcCommandParameter(mCurrentQAPair.Item1,true)).ToString() + "\r\n"); if (!mCurrentObject.IsImageQuestion()) { SendMessage(CurrentQuizObject.Question); } ShowStaff(CurrentQuizObject.GetImageQuestion()); }