Exemplo n.º 1
0
        private async void send_Click(object sender, RoutedEventArgs e)
        {
            string parameter = string.Empty;
            //NavigationContext.QueryString.TryGetValue("parameter", out parameter);

            //u = parameter;

            var firebase = new Firebase.Database.FirebaseClient("https://calendarbot-2573c.firebaseio.com/");
            //var More = new UserInfo();
            //More.info =
            // add new item to list of data and let the client generate new key for you (done offline)
            var ques = await firebase
                       .Child("users")
                       .Child(log)
                       .Child("questions")
                       .Child(question.Text)
                       .PostAsync(question.Text);

            string que = question.Text;

            ansAndQues.Children.Add(new TextBlock()
            {
                Text = question.Text
            });


            await AiResponse.GetResponse(question.Text);

            answer.Text = AiResponse.answer;

            //var ans = await firebase
            //    .Child("users")
            //    .Child(log)
            //    .Child("answers")
            //    .Child(answer.Text)
            //    .PostAsync(answer.Text);

            ansAndQues.Children.Add(new TextBlock()
            {
                Text = answer.Text
            });


            startTime.Text = AiResponse.startTime;
            endTime.Text   = AiResponse.endTime;
            title.Text     = AiResponse.title;
            date.Text      = AiResponse.date;

            appoint.Text  = AiResponse.appoint;
            question.Text = "";
        }
Exemplo n.º 2
0
        private async void send_Click(object sender, RoutedEventArgs e)
        {
            string parameter = string.Empty;


            var firebase = new Firebase.Database.FirebaseClient("https://calendarbot-2573c.firebaseio.com/");

            // add new item to list of data and let the client generate new key for you (done offline)
            var ques = await firebase
                       .Child("users")
                       .Child(log)
                       .Child("questions")
                       .PostAsync(question.Text);


            string que = question.Text;

            question.Text += "\n";
            ansAndQues.Children.Add(new TextBlock()
            {
                Text          = question.Text,
                TextAlignment = TextAlignment.Right,
                Foreground    = new SolidColorBrush(Colors.Black)
            });

            //TextTrimming.WordEllipsis = 5 , TextWrapping.Wrap = 4,
            //    Width = 200,

            scroll.UpdateLayout();
            scroll.ChangeView(0.0f, double.MaxValue, 1.0f);

            var histQ = await firebase
                        .Child("users")
                        .Child(log)
                        .Child("history")
                        .PostAsync(question.Text);

            await AiResponse.GetResponse(question.Text);

            answer.Text = AiResponse.answer;

            var ans = await firebase
                      .Child("users")
                      .Child(log)
                      .Child("answers")
                      .PostAsync(answer.Text);

            answer.Text += "\n";
            ansAndQues.Children.Add(new TextBlock()
            {
                Text = answer.Text, TextAlignment = TextAlignment.Left, Foreground = new SolidColorBrush(Colors.Gray)
            });

            scroll.UpdateLayout();
            scroll.ChangeView(0.0f, double.MaxValue, 1.0f);

            var histA = await firebase
                        .Child("users")
                        .Child(log)
                        .Child("history")
                        .PostAsync(answer.Text);

            //startTime.Text = AiResponse.startTime;
            //endTime.Text = AiResponse.endTime;
            login.Text = "Welcome " + log;

            question.Text = "";
        }