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.
30 lines
945 B
30 lines
945 B
using System;
|
|
using System.Collections.Generic;
|
|
using System.Globalization;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using WeatherClient.Models;
|
|
|
|
namespace WeatherClient.Converters
|
|
{
|
|
internal class WeatherConditionToImageConverter : IValueConverter
|
|
{
|
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
WeatherType weatherCondition = (WeatherType)value;
|
|
|
|
return weatherCondition switch
|
|
{
|
|
Models.WeatherType.Sunny => ImageSource.FromFile("sunny.png"),
|
|
Models.WeatherType.Cloudy => ImageSource.FromFile("cloud.png"),
|
|
_ => ImageSource.FromFile("question.png"),
|
|
};
|
|
}
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
}
|
|
}
|
|
|