Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
907 B
3
Indexable
using Newtonsoft.Json;
using proizvodi.model;
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 proizvodi
{
    public partial class MainPage : ContentPage
    {
        // https://pastecode.io/s/gj54nzsu   class
        //https://pastecode.io/s/g317dn2d   xaml
        public MainPage()
        {
            InitializeComponent();
            GetProizvodi();
        }

        private async void GetProizvodi()
        {
            HttpClient client = new HttpClient();
            string url = "https://dummyjson.com/products";
            var response = await client.GetStringAsync(url);
            var proizvod = JsonConvert.DeserializeObject < List < Proizvodi >>( response);
            proizvodiListView.ItemsSource = proizvod;
        }
    }
}