Wyrzuca mi błąd: Input string '0.29' is not a valid integer. Path 'main.temp', line 1, position 150.
Kod Strony Głównej:
using System;
using Plugin.Geolocator;
using Apponline.Models;
using Apponline.Services;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace Apponline.Views
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class WeatherPage : ContentPage
{
private WeatherService WeatherService { get; }
public WeatherPage()
{
InitializeComponent();
WeatherService = new WeatherService();
}
private async void GetWeatherButton_Clicked(object sender, EventArgs e)
{
try
{
RootObject weather;
if (GpsSwitch.IsToggled)
{
var gps = await CrossGeolocator.Current.GetPositionAsync();
weather = await WeatherService.GetWeather(gps.Latitude, gps.Longitude);
}
else
{
weather = await WeatherService.GetWeather(LocationEntry.Text.Trim());
}
TemperatureLabel.Text = $"{weather.main.temp}";
}
catch(Exception ex)
{
TemperatureLabel.Text = ex.Message;
}
}
}
}