C# Display questions and wait for a response

时间:2016-04-07 10:40:34

标签: c# wpf

I am writing a WPF program that reads a question document (example below) and presents the question and answers in an appropriate way. But my question is how do i get my program to display one question and then wait for the answer before then displaying the next. The answers are displayed using the method Display*Questiontype*(?). eg DisplayMultipleChoice(Question,CAnswer,Ianswer1,Ianswer2,Ianswer3).

Question Document;

& Multiple choice question
~ Correct Answer
- Incorrect Answer
- Incorrect Answer
- Incorrect Answer

? Textbox answer question
~Correct Answer

$ Webpage Question
@ Webpage

Here is a tried code

for (int i = 0; i < QuestionDocument.Length; i++)
            {

                if (QuestionDocument[i] == string.Empty)
                {
                    continue;
                }

                switch (QuestionDocument[i][0])
                {
                    case '&':
                        // get answers from document 
                        // DisplayMultiplechoice(Question,CAnswer,IAnswer1,IAnswer2,IAnswer3);
                        break;
                    case '?':
                        // get answers from document 
                        // DisplayMultiplechoice(Question,CAnswer,IAnswer1,IAnswer2,IAnswer3);
                        break;

                    case '#':
                        // get answers from document 
                        // DisplayMultiplechoice(Question,CAnswer,IAnswer1,IAnswer2,IAnswer3);
                        break;

                }
            }

1 个答案:

答案 0 :(得分:0)

我没有使用for循环,而是使用了一些相互调用的方法