Exemplo n.º 1
0
        public MainPage()
        {
            InitializeComponent();
            Cities cities = null;
            Task   t      = Task.Run(async() =>
            {
                CustomWebClient webClient = new CustomWebClient();
                cities = await webClient.GetCitiesData();
            });

            t.Wait();
            listView.ItemsSource = cities;
            ImageCircle.Forms.Plugin.Abstractions.CircleImage myImage = null;
        }
        public CityDetailsPage(City city)
        {
            List <WeatherData> data            = new List <WeatherData>();
            string             name            = city.Name;
            CustomWebClient    customWebClient = new CustomWebClient();
            Task t = Task.Run(async() =>
            {
                SelectedCity      = await customWebClient.GetCityData(city.ElementWebId);
                SelectedCity.Name = name;
                Title             = name;
                data.Add(new WeatherData("Visibility", SelectedCity.Visibility.ToString(), name));
                data.Add(new WeatherData("Cloud Cover", SelectedCity.CloudCover.ToString(), name));
                data.Add(new WeatherData("Temperature", SelectedCity.Temperature.ToString(), name));
                data.Add(new WeatherData("Wind Speed", SelectedCity.WindSpeed.ToString(), name));
                data.Add(new WeatherData("Humidity", SelectedCity.Humidity.ToString(), name));
            });

            t.Wait();
            BindingContext = SelectedCity;
            InitializeComponent();


            WeatherListView.ItemsSource = data;
        }