Beispiel #1
0
        /// <summary>
        /// Дать ответ
        /// </summary>
        /// <param name="answer">Ответ</param>
        public void TakeAnswer(int answer, bool onTimeEnded = false)
        {
            currentExample.UserAnswer = answer;
            // Устанавливам State:
            currentExample.SetState(answer == currentExample.UserAnswer ? ExampleState.RightAnswered : ExampleState.WrongAnswered);
            if (onTimeEnded)
            {
                currentExample.SetState(ExampleState.NotAnswered);
            }
            processedExample.Add(currentExample);

            if (exampleSet.Count > 0)
            {
                currentExample = exampleSet.Dequeue();
                TakeNextExample?.Invoke(this, new ExampleParameters(currentExample.OperandOne, currentExample.OperandTwo, currentExample.Opr));
                timer.Stop();
                Tick?.Invoke(this, timeToExample);
                remainingTime = timeToExample;
                timer.Start();
            }
            else
            {
                timer.Stop();
                IsStarted = false;
                TrainingEnded?.Invoke(this, DateTime.Now);
            }
        }