Esempio n. 1
0
 public QuestionListView(TestFormv2 form, QuizMasterServiceClient quizClient)
 {
     InitializeComponent();
     this.quizClient = quizClient;
     this.form       = form;
     questions       = quizClient.GetQuestions().ToList();
     data            = new BindingList <Question>();
     FillDataList();
     listBoxQuestion.DisplayMember = "Header";
     listBoxQuestion.DataSource    = data;
 }
Esempio n. 2
0
        /// <summary>
        /// Constructor for this view.
        /// It gets the questions for the quiz and all questions
        /// then makes a list of all questions not on the list to display
        /// beside the list of questions that is on the list.
        /// </summary>
        /// <param name="form"></param>
        /// <param name="quizClient"></param>
        public QuizQuestionView(TestFormv2 form, QuizMasterServiceClient quizClient)
        {
            InitializeComponent();
            this.form         = form;
            this.quizClient   = quizClient;
            allQuestions      = quizClient.GetQuestions();
            quizQuestions     = quizClient.GetAllByQuizId(form.ActiveQuiz.Id);
            includedQuestions = new BindingList <Question>(quizQuestions);

            // Get all questions not on the quiz
            var result = allQuestions.Where(aq => !quizQuestions.Any(qq => aq.Id == qq.Id)).ToList();

            excludedQuestions = new BindingList <Question>(result);
            listBoxQuestionsOnQuiz.DisplayMember    = "Header";
            listBoxQuestionsNotOnQuiz.DisplayMember = "Header";
            listBoxQuestionsOnQuiz.DataSource       = includedQuestions;
            listBoxQuestionsNotOnQuiz.DataSource    = excludedQuestions;
        }