public DataSource(WeatherTableViewController weatherTableViewController) { this.weatherTableViewController = weatherTableViewController; WeatherRequests request = new WeatherRequests(); DepartmentList = request.GetListDepartamentShortInfo(); }
private void LoadingDepartmentData() { WeatherRequests request = new WeatherRequests(); listOfDepartamens = request.GetListDepartamentShortInfo(); //WeatherData oneW = request.GetAllInfoOneCity("Cochabamba", "Bolivia"); // Create your application here RunOnUiThread(() => { adapter.Items = listOfDepartamens; adapter.NotifyDataSetChanged(); _progress.Dismiss(); }); Task.Delay(1000); }
private async Task AddFavorite() { var favoriteText = await _alertService.DisplayInputEntryAsync("MCWeather", "Enter city name", validator : (text) => { return(WeatherRequests?.Where((WeatherRequest i) => (i as WeatherRequest)?.City?.Name == text).Count() == 0); }); if (!string.IsNullOrWhiteSpace(favoriteText)) { Weather weather = null; try { weather = await _weatherService.GetWeatherAsync(favoriteText); } catch (Exception ex) { Debug.WriteLine(ex.Message); } finally { if (weather == null) { await _alertService.DisplayAsync("MCWeather", $"Cannot find weather data for {favoriteText}", "OK"); } else { var favoriteCity = await _favoritesService.AddFavoriteCityAsync(new City { Name = favoriteText }); WeatherRequests.Add(new WeatherRequest { City = new City { Name = favoriteText } }); ReloadAction?.Invoke(); } } } }
private void LoadWeatherDetail() { string[] infoDepart = departmentName.Split(','); WeatherRequests request = new WeatherRequests(); WeatherData departmentDetail = request.GetAllInfoOneCity(infoDepart[0], infoDepart[1]); RunOnUiThread(() => { _temperature.Text = departmentDetail.Item.Condition.Temp + "°" + departmentDetail.Units.Temperature; var imageBitmap = HelperImage.GetImageBitmapFromUrl("http://l.yimg.com/a/i/us/we/52/" + departmentDetail.Item.Condition.Code + ".gif"); _imageWeather.SetImageBitmap(imageBitmap); _weatherName.Text = departmentDetail.Item.Condition.Text; _titleDepartamen.Text = departmentDetail.Location.City + ", " + departmentDetail.Location.Country; _windDirection.Text = departmentDetail.wind.Direction; _windSpeed.Text = departmentDetail.wind.Speed; _atmosHumidity.Text = departmentDetail.Atmosphere.Humidity; _atmosPressure.Text = departmentDetail.Atmosphere.Pressure; _atmosVisibility.Text = departmentDetail.Atmosphere.Visibility; _progress.Dismiss(); _RootLayoutl.Visibility = ViewStates.Visible; }); Task.Delay(1000); }