コード例 #1
0
ファイル: BuyersChat.xaml.cs プロジェクト: Marcus1920/Lobloba
        private async void Listmesage_OnRefreshingnRefreshingAsync(object sender, EventArgs e)
        {
            var allProducts = await data.GetChatlistmessage(PostId);

            _transactions = new ObservableCollection <ChatModel>(allProducts);

            Listmesage.ItemsSource = _transactions;

            Listmesage.EndRefresh();
        }
コード例 #2
0
        private async void Listmesage_OnRefreshingAsync(object sender, EventArgs e)
        {
            var allProducts = await data.GetChatlistmessage(PostId);

            _transactions          = new ObservableCollection <ChatModel>(allProducts);
            Listmesage.ItemsSource = _transactions;

            Listmesage.EndRefresh();



            var lastMessage = this.Listmesage.ItemsSource.Cast <object>().LastOrDefault();

            if (null != lastMessage)
            {
                this.Listmesage.ScrollTo(lastMessage, ScrollToPosition.End, true);
            }

            base.OnAppearing();

            var values = new FormUrlEncodedContent(new[]
            {
                new KeyValuePair <string, string>("post_id", PostId),
                new KeyValuePair <string, string>("api_key", _apiKey)
            });


            var client   = new HttpClient();
            var response = await client.PostAsync("http://dev.foodforus.cloud/public/api/v1/conversation", values);

            var respond = await response.Content.ReadAsStringAsync();

            size = respond.Length;

            StartTimer();
        }