Exemple #1
0
        public MainPageViewModel()

        {
            // Initialize with default values
            Messages = new ObservableCollection <MessageViewModel>
            {
                new MessageViewModel {
                    MessageStr = "Say Hi to start talking to me!", IsIncoming = true, DateTime = DateTime.Now
                }
            };

            OutGoingText = null;

            SendCommand = new Command(() =>

            {
                ProcessMessage();
            });

            directLineManager = new DirectLineManager();
        }
        public async Task InitAsync()
        {
            this.IsBusy = true;
            string conversationId;

            //if (!string.IsNullOrEmpty(await SecureStorage.GetAsync("FlorenceConversation")))
            //{
            //  conversationId = await SecureStorage.GetAsync("FlorenceConversation");
            //}
            //else
            //{
            conversationId = DirectLineManager.StartConversation(this.Florence.DirectLineSecret);
            //  await SecureStorage.SetAsync("FlorenceConversation", conversationId);
            //}

            this.DirectLineManager = new DirectLineManager(this.Florence.DirectLineSecret, conversationId);
            this.DirectLineManager.ActivitiesReceived += this.OnActivitiesReceived;

            this.Messages.Add(new TextMessage {
                Text = "Hey Florence!", Author = this.Author
            });

            this.IsBusy = false;
        }