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
955 B
30 lines
955 B
using System.Globalization;
|
|
|
|
namespace Stim.Converter
|
|
{
|
|
public class DoubleToStar : IValueConverter
|
|
{
|
|
public string EtoileVide { get; set; }
|
|
public string EtoileMiPleine { get; set; }
|
|
public string EtoilePleine { get; set; }
|
|
|
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
if (value is double && parameter is string)
|
|
{
|
|
double rate = double.Parse(value.ToString());
|
|
int pos = int.Parse(parameter as string);
|
|
|
|
if (pos <= rate) return EtoilePleine;
|
|
if (pos - 1 < rate && rate < pos) return EtoileMiPleine;
|
|
}
|
|
return EtoileVide;
|
|
}
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
}
|
|
}
|