Example #1
0
        /// <summary>
        /// create stack pannel with choises
        /// </summary>
        /// <param name="question"></param>
        /// <param name="ans"></param>
        /// <returns></returns>
        public void createBubbleContentChoice(StackPanel stackPanel, Conversation.ConversetionAnswers.Conversation question)
        {
            this.question = question;
            TextBlock textBlock = new TextBlock();

            this.stackPanel = stackPanel;
            //List<TextBlock> choises = new List<TextBlock>();
            //StackPanel stackPanel = new StackPanel();
            TextBlock textBlock2 = new TextBlock();

            textBlock2.Text     = question.botLine;
            textBlock2.Margin   = new Thickness(10, 0, 0, 0);
            textBlock2.FontSize = 20;
            stackPanel.Children.Add(textBlock2);
            for (int i = 0; i < 4; i++)
            {
                choises.Add(new TextBlock());
                choises[choises.Count - 1].FontSize             = 20;
                choises[choises.Count - 1].Margin               = new Thickness(5, 0, 0, 0);
                choises[choises.Count - 1].Text                 = question.answers[i].userLine;
                choises[choises.Count - 1].MouseLeftButtonDown += choicesHandler;
                stackPanel.Children.Add(choises[choises.Count - 1]);
            }

            //return stackPanel;
        }
        public ConversetionAnswers.Conversation GetConversation()
        {
            string typeOfConversation =
                dataBaseMenager.GetConversationType()[
                    rand.Next(0, dataBaseMenager.GetConversationType().Count - 1)];

            firstLvl  = new List <AnswerOfFirstLevel>(dataBaseMenager.GetFirstAnswerLVL(typeOfConversation));
            secondLvl = new List <AnswerOfSecondLvl>(dataBaseMenager.GetSecondAnswerLVL(typeOfConversation));
            thirdLvl  = new List <AnswerOfThirdLevel>(dataBaseMenager.GetThirdAnswerLVL(typeOfConversation));

            ConversetionAnswers.Conversation conversation = dataBaseMenager
                                                            .GetConversation(typeOfConversation)[rand.Next(0, dataBaseMenager.GetConversation(typeOfConversation).Count - 1)];

            if (conversation.answers == null)
            {
                conversation.answers = new List <AnswerOfFirstLevel>();
            }

            for (int i = 0; i < 4; i++)
            {
                var answer = firstLvl[i];
                //firstLvlLocal.Remove(answer);
                addToFirstLvl(answer);
                conversation.answers.Add(answer);
            }

            return(conversation);
        }