Esempio n. 1
0
        private void addAnsweredQuestion(Question q=null, String answer="")
        {
            ListViewItem item = new ListViewItem();
            RichTextBlock tb = new RichTextBlock();

            tb.Foreground = new SolidColorBrush(Colors.WhiteSmoke);

            Paragraph p = new Paragraph();
            tb.FontSize = 16;
            Run r = new Run();
            Run r2 = new Run();
            if (q != null)
            {
                r.Text = q.content.Trim();
                if (!answer.Equals(""))
                {
                    r.Text += ": ";
                    r2.Text = answer + "\n";
                    r2.FontWeight = FontWeights.Bold;
                    p.Inlines.Add(r);
                    p.Inlines.Add(r2);
                }
                else
                {
                    r2.Text = "Conclusion: ";
                    r2.FontWeight = FontWeights.Bold;
                    p.Inlines.Add(r2);
                    p.Inlines.Add(r);
                }
            }
            else
            {
                r.Text = answer + "\n";
                r.FontWeight = FontWeights.Bold;
                p.Inlines.Add(r);
            }

            tb.Blocks.Add(p);

            item.Content = tb;
            answeredQuestions.Items.Add(item);
        }
Esempio n. 2
0
 private void updateConclusions(Question q)
 {
     if (!setQuestion(q))
         checkConclusions();
     else
     {
         fututreConclusionsListView.Items.Clear();
         addAnsweredQuestion(q);
     }
 }
Esempio n. 3
0
        private bool setQuestion(Question q)
        {
            questionsTextBlock.Blocks.Clear();
            Paragraph p = new Paragraph();
            p.TextIndent = 0;
            Run run = new Run();
            run.Text = q.content;

            bool conclusionFlag = false;

            if (q.isConclusion)
            {
                Run conclusion = new Run();
                conclusion.Text = "Conclusion:\n";

                p.Inlines.Add(conclusion);

                noButton.Visibility = Visibility.Collapsed;
                yesButton.Visibility = Visibility.Collapsed;
                conclusionFlag = true;
            }

            presentQuestion = q;

            p.Inlines.Add(run);

            questionsTextBlock.Blocks.Add(p);
            return conclusionFlag;
        }
Esempio n. 4
0
        public void test(List<int> prev, Question q)
        {
            Question q1 = findQuestion(q.no);
            Question q2 = findQuestion(q.yes);

            if (q.isConclusion)
            {
                futureConclusions.Add(q);
                return;
            }

            List<int> newVector = new List<int>(prev);
            newVector.Add(q1.ID);

            listOLists.Add(newVector);
            test(newVector, q1);

            prev.Add(q2.ID);
            test(prev, q2);
        }
Esempio n. 5
0
        private void processFile(List<Question> list)
        {
            List<String> headers = new List<string>();
            String test = "";
            if (answeredQuestions.Items.Count > 0)
                answeredQuestions.Items.Clear();

            if (fututreConclusionsListView.Items.Count > 0)
                fututreConclusionsListView.Items.Clear();

            futureConclusions.Clear();
            answeredQuestionsIdList.Clear();

            foreach (PivotItem pi in this.pivot.Items)
            {
                headers.Add(pi.Header.ToString());
            }

            if (!(headers.Contains("History") && headers.Contains("Conclusions")))
            {
                PivotItem history = new PivotItem();
                history.Header = "History";
                StackPanel stackpanel = new StackPanel();
                stackpanel.Children.Add(answeredQuestions);
                history.Content = stackpanel;

                PivotItem conclusions = new PivotItem();
                conclusions.Header = "Conclusions";
                StackPanel stackpanel2 = new StackPanel();
                stackpanel2.Children.Add(fututreConclusionsListView);
                conclusions.Content = stackpanel2;

                this.pivot.Items.Insert(2, history);
                this.pivot.Items.Insert(4, conclusions);
            }

            questions = list;

            yesButton.Visibility = Visibility.Visible;
            noButton.Visibility = Visibility.Visible;
            backButton.Visibility = Visibility.Visible;
            presentQuestion = findQuestion(0);

            Run run = new Run();
            run.Text = presentQuestion.content;
            Paragraph p = new Paragraph();
            p.Inlines.Add(run);
            questionsTextBlock.Blocks.Clear();
            questionsTextBlock.Blocks.Add(p);

            foreach (Question q in questions)
            {
                if (q.isConclusion)
                {
                    futureConclusions.Add(q);
                    addConclusionToListView(q.content + "\n");
                }
            }
        }