public MapPage(Wheather whether) { InitializeComponent(); Temperature.Text = whether.main.temp.ToString(); Humidity.Text = whether.main.humidity.ToString(); Wind.Text = whether.wind.speed.ToString(); Location.Text = whether.sys.country; _sqLiteConnection = DependencyService.Get <ISQLite>().GetConnection(); _sqLiteConnection.CreateTable <WhetherDataModel>(); listView = new ListView { ItemsSource = _sqLiteConnection.Table <WhetherDataModel>() }; dataName.Children.Add(listView); data = whether; Xamarin.Forms.Device.BeginInvokeOnMainThread(() => { googlemap.MoveToRegion(MapSpan.FromCenterAndRadius(new Position(37.39, -122.09), Distance.FromMeters(500))); }); }
private WeatherForecastModel MapToWeatherForecastModel(Wheather wheather) { return(new WeatherForecastModel { DateFormatted = wheather.DateFormatted.ToString("dd.MM.yyyy"), TemperatureC = wheather.TemperatureC, Summary = wheather.Summary, TemperatureF = CalculateF(wheather.TemperatureC) }); }
public void CountPeriod(Wheather weatherType) { switch (weatherType) { case Wheather.Drought: this.DroughtPeriods++; break; case Wheather.Rains: this.RainsPeriod++; break; case Wheather.Best: this.BestPeriods++; break; default: break; } }
public async void PostGetWheather([FromForm] string text, [FromForm] string response_url) { string city = text; RootObject obj = await Wheather.GetWeather(city); city = (city == "msk")? "Москве":"Санкт-Петербурге"; Result res = new Result { text = $"Сейчас в {city} *{obj.fact.temp}* (°C), {obj.fact.condition}\n" + $"Подробнее на Яндексе -> {obj.info.url} " }; var client = new HttpClient(); await client.PostAsync(response_url, new StringContent( JsonConvert.SerializeObject(res), Encoding.UTF8, "application/json")); }