Untitled

 avatar
unknown
plain_text
2 years ago
832 B
1
Indexable
using apw.model;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;

namespace apw
{
    public partial class MainPage : ContentPage
    {
        public MainPage()
        {
            InitializeComponent();
            GetPosts();
        }

        private async void GetPosts()
        {
            HttpClient client = new HttpClient();
            string url = "https://jsonplaceholder.typicode.com/posts";
            var response = await client.GetStringAsync(url);
            var post = JsonConvert.DeserializeObject<List<Post>>(response);
            postListView.ItemsSource = post;
                //https://pastecode.io/s/dgkju8sm  xaml

        }
    }
}