Example #1
0
        private void UpdateListMessages(List <Microsoft.Bot.Connector.DirectLine.Activity> messages)
        {
            MessagesList.RemoveAt(0);
            Adapter.NotifyDataSetChanged();
            foreach (var message in messages)
            {
                if (MessageChecker.CheckTypeOfMessage(message) == AttachmentType.None)
                {
                    AddMessageToList(message);

                    if (MessageChecker.CheckInputType(message.Text) == InputType.Birthday)
                    {
                        AddDatePicker();
                    }
                    else
                    {
                        _datePicker = false;
                    }

                    SetInputLayout(true);
                }
                else
                {
                    var attachmentContent = JsonConvert.DeserializeObject <AttachmentContent>(message.Attachments[0].Content.ToString());
                    message.Text = attachmentContent.Text;

                    SetInputLayout(false);

                    AddMessageToList(message);
                    AddButtons(attachmentContent.Buttons.ToList());
                }
            }
        }
Example #2
0
                public virtual void OnNext(Model.Message value)
                {
                    App.Current.Dispatcher.BeginInvoke((Action)(() =>
                    {
                        bool result = value.EncodeMessage(Encoding.Unicode);
                        if (!result)
                        {
                            return;
                        }

                        messagesQueue.Add(value);
                        if (messagesQueue.Count > 2)
                        {
                            messagesQueue.RemoveAt(0);
                        }
                    }));
                }