コード例 #1
0
        private int NeueKarteikarte()
        {
            RecordCardContent content;

            switch (comBoxKarteikartentyp.SelectedIndex)
            {
            case 0:
                content = new RecordCardTextContent();
                break;

            case 1:
                content = new RecordCardAbbildungContent();
                break;

            case 2:
                content = new RecordCardAufzaehlungContent();
                break;

            case 3:
                content = new RecordCardMultipleChoiceContent();
                break;

            default:
                throw new Exception();     //TODO HANDLE
            }
            return(karteikartenEditor.NeueKarteikarte(txtBxThema.Text, content));
        }
コード例 #2
0
 public RecordcardMultipleChoiceGUI(RecordCardMultipleChoiceContent content)
 {
     InitializeComponent();
     txtBoxMCFrage.Text = content.ErhalteQuestion();
     foreach (var item in content.ErhalteMultipleChoiceListe())
     {
         checkedListBoxMCFrage.Items.Add(item);
     }
     txtBoxMCAntwort.Text = content.AnswerMultipleChoice;
 }
コード例 #3
0
        public void Test_MCRecordcardType()
        {
            // Arrange
            RecordCardMultipleChoiceContent x = new RecordCardMultipleChoiceContent();

            // Act
            string actual = x.ErhalteRecordCardType();

            // Assert
            Assert.Equal("Multiple Choice", actual);
        }
コード例 #4
0
        public override RecordCardContent EntnehmeContent()
        {
            RecordCardMultipleChoiceContent recordCardMultipleChoiceContent = new RecordCardMultipleChoiceContent();

            recordCardMultipleChoiceContent.QuestionMultipleChoice = txtBoxMCFrage.Text;
            foreach (var item in checkedListBoxMCFrage.Items)
            {
                recordCardMultipleChoiceContent.FuegeMultipleChoiceWertHinzu(item.ToString());
            }
            recordCardMultipleChoiceContent.AnswerMultipleChoice = txtBoxMCAntwort.Text;
            return(recordCardMultipleChoiceContent);
        }
コード例 #5
0
        public void Test_MCAnswers()
        {
            // Arrange
            RecordCardMultipleChoiceContent x = new RecordCardMultipleChoiceContent();

            x.AnswerMultipleChoice = "Antworten!";

            // Act
            string actual = x.AnswerMultipleChoice;

            // Assert
            Assert.Equal("Antworten!", actual);
        }
コード例 #6
0
        public void Test_MCQuestions()
        {
            // Arrange
            RecordCardMultipleChoiceContent x = new RecordCardMultipleChoiceContent();

            x.QuestionMultipleChoice = "Frage?";

            // Act
            string actual = x.QuestionMultipleChoice;

            // Assert
            Assert.Equal("Frage?", actual);
        }
コード例 #7
0
        public void Test_MCQuestion()
        {
            // Arrange
            RecordCardMultipleChoiceContent x = new RecordCardMultipleChoiceContent();

            x.QuestionMultipleChoice = "Hallo?";

            // Act
            string actual = x.ErhalteQuestion();

            // Assert
            Assert.Equal("Hallo?", actual);
        }
コード例 #8
0
        private static void DeserialisiereRecordCards(RecordcardSet recordcardSet, XmlElement recordcardsetNode)
        {
            foreach (XmlElement recordcardnode in recordcardsetNode.GetElementsByTagName("recordcard"))
            {
                if (recordcardnode.Name == "recordcard")
                {
                    Recordcard recordcard = new Recordcard();
                    recordcard.Thema = recordcardnode.GetAttribute("topic");
                    String type = recordcardnode.GetAttribute("type");

                    if (type == "Text")
                    {
                        RecordCardTextContent recordCardContentText = new RecordCardTextContent();

                        XmlNodeList questionNodes = recordcardnode.GetElementsByTagName("questionText");
                        XmlNodeList answerNodes = recordcardnode.GetElementsByTagName("answerText");
                        XmlElement  questionNode = null, answerNode = null;

                        if (questionNodes.Count > 0)
                        {
                            questionNode = (XmlElement)questionNodes.Item(0);
                            recordCardContentText.QuestionText = questionNode.InnerText;
                        }

                        if (answerNodes.Count > 0)
                        {
                            answerNode = (XmlElement)answerNodes.Item(0);
                            recordCardContentText.AnswerText = answerNode.InnerText;
                        }

                        recordcard.content = recordCardContentText;
                    }
                    else if (type == "Abbildung")
                    {
                        RecordCardAbbildungContent content = new RecordCardAbbildungContent();

                        XmlNodeList questionNodes = recordcardnode.GetElementsByTagName("questionAbbildung");
                        XmlNodeList answerNodes = recordcardnode.GetElementsByTagName("answerAbbildung");
                        XmlElement  questionNode = null, answerNode = null;

                        if (questionNodes.Count > 0)
                        {
                            questionNode = (XmlElement)questionNodes.Item(0);
                            content.QuestionAbbildung = questionNode.InnerText;
                        }

                        if (answerNodes.Count > 0)
                        {
                            answerNode        = (XmlElement)answerNodes.Item(0);
                            content.ImagePath = answerNode.InnerText;
                        }

                        recordcard.content = content;
                    }
                    else if (type == "Aufzaehlung")
                    {
                        RecordCardAufzaehlungContent content = new RecordCardAufzaehlungContent();


                        XmlNodeList questionNodes = recordcardnode.GetElementsByTagName("questionAufzaehlung");
                        XmlNodeList answerNodes = recordcardnode.GetElementsByTagName("answerAufzaehlung");
                        XmlElement  questionNode = null, answerNode = null;

                        if (questionNodes.Count > 0)
                        {
                            questionNode = (XmlElement)questionNodes.Item(0);
                            content.QuestionAufzaehlung = questionNode.InnerText;
                        }

                        if (answerNodes.Count > 0)
                        {
                            answerNode = (XmlElement)answerNodes.Item(0);
                            foreach (XmlElement answerItem in answerNode.GetElementsByTagName("item"))
                            {
                                content.FuegeAntwortHinzu(answerItem.InnerText);
                            }
                        }

                        recordcard.content = content;
                    }
                    else if (type == "MultipleChoice")
                    {
                        RecordCardMultipleChoiceContent content = new RecordCardMultipleChoiceContent();

                        XmlNodeList questionNodes = recordcardnode.GetElementsByTagName("questionMultipleChoice");
                        XmlNodeList choicesNodes = recordcardnode.GetElementsByTagName("choicesMultipleChoice");
                        XmlNodeList answerNodes = recordcardnode.GetElementsByTagName("answerMultipleChoice");
                        XmlElement  questionNode = null, answerNode = null, choiceNode = null;

                        if (questionNodes.Count > 0)
                        {
                            questionNode = (XmlElement)questionNodes.Item(0);
                            content.QuestionMultipleChoice = questionNode.InnerText;
                        }

                        if (choicesNodes.Count > 0)
                        {
                            choiceNode = (XmlElement)choicesNodes.Item(0);
                            foreach (XmlElement choiceItem in choiceNode.GetElementsByTagName("item"))
                            {
                                content.FuegeMultipleChoiceWertHinzu(choiceItem.InnerText);
                            }
                        }

                        if (answerNodes.Count > 0)
                        {
                            answerNode = (XmlElement)answerNodes.Item(0);
                            content.AnswerMultipleChoice = answerNode.InnerText;
                        }
                        recordcard.content = content;
                    }

                    recordcardSet.RecordcardList.Add(recordcard);
                }
            }
        }