You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
jellyfin/MediaBrowser.UI/Converters/WeatherTemperatureConverter.cs

32 lines
965 B

using MediaBrowser.Model.Weather;
using System;
using System.Globalization;
using System.Windows.Data;
namespace MediaBrowser.UI.Converters
{
public class WeatherTemperatureConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
var weather = value as WeatherInfo;
if (weather != null)
{
if (App.Instance.ServerConfiguration.WeatherUnit == WeatherUnits.Celsius)
{
return weather.CurrentWeather.TemperatureCelsius + "°C";
}
return weather.CurrentWeather.TemperatureFahrenheit + "°F";
}
return null;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}