Ejemplo n.º 1
0
        public ChatPage(Conversation con) : this()
        {
            var vm = new Chat.ViewModels.ChatPageViewModel(con);

            vm.View             = this;
            this.BindingContext = vm;

            this.Title        = con.Title;
            ScrollListCommand = new Command(() =>
            {
                ChatList.ScrollToLast();
            });
            if (!string.IsNullOrEmpty(con.HTMLTable))
            {
                var webView = MessageBoard.FindByName <WebView>("webView");
                webView.Source = new HtmlWebViewSource
                {
                    Html = con.HTMLTable
                };
            }
            // ChatList.Opacity = 0;
            //var itemSource = ChatList.ItemsSource as ObservableCollection<GroupedMessage>;
            //var lastMessage = itemSource.Last().Last();

            ChatList.ScrollToLast();
            //ChatList.ScrollToLast();
            //ChatList.ScrollTo(lastMessage, ScrollToPosition.MakeVisible, false);
            // ChatList.Opacity = 1;
        }
Ejemplo n.º 2
0
        public void ScrollTap(object sender, System.EventArgs e)
        {
            lock (new object())
            {
                if (BindingContext != null)
                {
                    var vm = BindingContext as ChatPageViewModel;

                    Device.BeginInvokeOnMainThread(() =>
                    {
                        vm.ShowScrollTap       = false;
                        vm.LastMessageVisible  = true;
                        vm.PendingMessageCount = 0;

                        ChatList.ScrollToLast();
                    });
                }
            }
        }
Ejemplo n.º 3
0
        public void ScrollTap(object sender, System.EventArgs e)
        {
            lock (new object())
            {
                if (BindingContext != null)
                {
                    ChatPageViewModel vm = BindingContext as ChatPageViewModel;

                    Device.BeginInvokeOnMainThread(() =>
                    {
                        while (vm.DelayedMessages.Count > 0)
                        {
                            //vm.Messages.Insert(0, vm.DelayedMessages.Dequeue());
                            vm.Messages.Add(vm.DelayedMessages.Dequeue());
                        }
                        vm.ShowScrollTap       = false;
                        vm.LastMessageVisible  = true;
                        vm.PendingMessageCount = 0;
                        ChatList?.ScrollToLast();
                    });
                }
            }
        }