Beispiel #1
0
        private void UpdateView(Question nextQues, bool isShownAnswerkey)
        {
            //throw new NotImplementedException();

            if (_view is V_Vong1_Thi)
            {
                V_Vong1_Thi myView = _view as V_Vong1_Thi;
                if (nextQues == null)// het cau hoi vong nay
                {
                    return;

                    ////
                    ///
                }
                if (nextQues is Compound)
                {
                    Compound ques = nextQues as Compound;
                    myView.QuestionText = ques.QuestionContent + "\nA." + ques.ChoiceA + "\nB." + ques.ChoiceB + "\nC." + ques.ChoiceC + "\nD." + ques.ChoiceD;
                }
                else if (nextQues is Multiple_Choice)
                {
                    Multiple_Choice ques = nextQues as Multiple_Choice;
                    myView.QuestionText = ques.QuestionContent + "\nA." + ques.ChoiceA + "\nB." + ques.ChoiceB + "\nC." + ques.ChoiceC + "\nD." + ques.ChoiceD;
                }
                else if (nextQues is Fill_In)
                {
                    Fill_In ques = nextQues as Fill_In;
                    myView.QuestionText = ques.QuestionContent.Replace("NNN", "...");
                }
                else
                {
                    myView.QuestionText = nextQues.QuestionContent;
                }

                myView.QuestionNumText = nextQues.STT;

                if (isShownAnswerkey)
                {
                    try
                    {
                        myView.AnswerKey = _preQuestion.AnswerKey;
                    }
                    catch
                    {
                    }
                    _tmrCheckCauhoi.Stop();

                    Timer tmrDung = new Timer();
                    tmrDung.Enabled = true;
                    //
                    if (myView.AnswerKey.Length < 10)
                    {
                        tmrDung.Interval = 1000;
                    }
                    else
                    {
                        tmrDung.Interval = 2000;
                    }
                    tmrDung.Start();
                    tmrDung.Tick += delegate(object send, EventArgs ev)
                    {
                        _tmrCheckCauhoi.Start();
                        myView.AnswerKey = "";
                        tmrDung.Stop();
                        tmrDung.Dispose();
                    };
                }
                else
                {
                    myView.AnswerKey = "";
                }
            }
        }
 //test
 public App(V_Vong1_Thi view)
 {
     _view            = view;
     _controller      = new Team_Vong1_Controller(_view);
     _view.Controller = _controller;
 }