예제 #1
0
        private void AddNewQuestionLine(int rowNumber, int position, Question question)
        {
            QuestionControl questionControl = new QuestionControl(question);

            Grid.SetRow(questionControl, rowNumber);
            timeLineControlContainer.Children.Add(questionControl);

            questionControlList.Insert(position, questionControl);
        }
예제 #2
0
        //private void TimeInterval_ControlMouseEnter(int indexBefore, int indexAfter)
        //{
        //    questionControlList[indexBefore].textBlockQuestion.FontSize = 30;
        //    questionControlList[indexAfter].textBlockQuestion.FontSize = 30;
        //}

        //private void TimeInterval_ControlMouseLeave(int indexBefore, int indexAfter)
        //{
        //    questionControlList[indexBefore].textBlockQuestion.FontSize = 24;
        //    questionControlList[indexAfter].textBlockQuestion.FontSize = 24;
        //}

        private async void TimeInterval_ControlMouseDown(int controlIndex)
        {
            TimeIntervalControl clickedTimeIntervalControl = timeIntervalControlList[controlIndex];
            TimeIntervalControl validTimeIntervalControl   = null;

            QuestionControl questionBefore = questionControlList[clickedTimeIntervalControl.IndexQuestionBefore];
            QuestionControl questionAfter  = questionControlList[clickedTimeIntervalControl.IndexQuestionAfter];

            bool isAnswerValid;

            if (CurrentQuestion.Index > questionBefore.Question.Index &&
                CurrentQuestion.Index < questionAfter.Question.Index)
            {
                clickedTimeIntervalControl.ExpandControl();

                await Task.Delay(500);

                InsertQuestion(controlIndex);

                clickedTimeIntervalControl.ShowAsNormal();

                isAnswerValid = true;
            }
            else
            {
                clickedTimeIntervalControl.ShowAsWrongAnswer();

                WrongAnswerLifeChange?.Invoke();

                await Task.Delay(1000);

                for (int i = 0; i < timeIntervalControlList.Count; i++)
                {
                    questionBefore = questionControlList[timeIntervalControlList[i].IndexQuestionBefore];
                    questionAfter  = questionControlList[timeIntervalControlList[i].IndexQuestionAfter];

                    if (CurrentQuestion.Index > questionBefore.Question.Index &&
                        CurrentQuestion.Index < questionAfter.Question.Index)
                    {
                        validTimeIntervalControl = timeIntervalControlList[i];
                        break;
                    }
                }

                if (clickedTimeIntervalControl.Index > validTimeIntervalControl.Index)
                {
                    questionBefore.BringIntoView();
                }
                else
                {
                    questionAfter.BringIntoView();
                }
                validTimeIntervalControl.ExpandControl();

                await Task.Delay(500);

                InsertQuestion(validTimeIntervalControl.Index);

                clickedTimeIntervalControl.ShowAsNormal();
                validTimeIntervalControl.ShowAsNormal();

                isAnswerValid = false;
            }

            await Task.Delay(500);

            CheckingAnswerResult?.Invoke(isAnswerValid);
        }