예제 #1
0
        //Insert information entered in the pnlQuestionDetails into the question array when it is a questionObjectComplex
        private void applyChangesToQuesitonComplex(questionObjectComplex question)
        {
            question = new questionObjectComplex();
            question.questionText   = pnlQuestionDetails.Controls.Find("questionEdit", true)[0].Controls.Find("questionText", true)[0].Text;
            question.questionType   = questionEdit.GetChildAtPoint(new Point(68, 29)).Text;
            question.questionNumber = pnlQuestionDetails.Controls.Find("questionEdit", true)[0].Controls.Find("questionNum", true)[0].Text;
            question.weight         = int.Parse(pnlQuestionDetails.Controls.Find("questionEdit", true)[0].Controls.Find("weight", true)[0].Text);

            question.questionItems = new List <itemContainer>();
            int panelNumber = 0;

            foreach (Panel c in pnlQuestionDetails.Controls)
            {
                if (c.Name != "questionEdit")
                {
                    //Go through container panels and create new container based off the panel name (is number)
                    itemContainer tempContainer = new itemContainer();
                    tempContainer.itemContainerLabel = c.Controls[1].Text;
                    tempContainer.items = new List <questionItemBase>();
                    question.questionItems.Add(tempContainer);
                    //Go through each item panel, then add item to corresponding container object.
                    for (int t = 0; t < (c.Controls.Count - 4); t++)
                    {
                        var item = c.Controls[t + 4];
                        questionItemBase tempItem = new questionItemBase();
                        tempItem.itemText = item.Controls[1].Text;
                        question.questionItems[panelNumber - 1].items.Add(tempItem);
                    }
                }
                panelNumber++;
            }
            game[(int)lastSelected.Tag] = question;
        }
        //Insert information entered in the pnlQuestionDetails into the question array when it is a questionObjectComplex
        private void applyChangesToQuesitonComplex(questionObjectComplex question)
        {
            question = new questionObjectComplex();
            question.questionText = pnlQuestionDetails.Controls.Find("questionEdit", true)[0].Controls.Find("questionText", true)[0].Text;
            question.questionType = questionEdit.GetChildAtPoint(new Point(68, 29)).Text;
            question.questionNumber = pnlQuestionDetails.Controls.Find("questionEdit", true)[0].Controls.Find("questionNum", true)[0].Text;
            question.weight = int.Parse(pnlQuestionDetails.Controls.Find("questionEdit", true)[0].Controls.Find("weight", true)[0].Text);

            question.questionItems = new List<itemContainer>();
            int panelNumber = 0;
            foreach (Panel c in pnlQuestionDetails.Controls)
            {
                if (c.Name != "questionEdit")
                {
                    //Go through container panels and create new container based off the panel name (is number)
                    itemContainer tempContainer = new itemContainer();
                    tempContainer.itemContainerLabel = c.Controls[1].Text;
                    tempContainer.items = new List<questionItemBase>();
                    question.questionItems.Add(tempContainer);
                    //Go through each item panel, then add item to corresponding container object.
                    for (int t = 0; t < (c.Controls.Count - 4); t++)
                    {
                        var item = c.Controls[t + 4];
                        questionItemBase tempItem = new questionItemBase();
                        tempItem.itemText = item.Controls[1].Text;
                        question.questionItems[panelNumber - 1].items.Add(tempItem);
                    }
                }
                panelNumber++;
            }
            game[(int)lastSelected.Tag] = question;
        }