|
|
|
@ -5,11 +5,11 @@ namespace Qwirkle.Converters
|
|
|
|
|
{
|
|
|
|
|
public class Int2ColorConverter : IValueConverter
|
|
|
|
|
{
|
|
|
|
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
|
|
|
|
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
|
|
|
|
{
|
|
|
|
|
if (value is not string) return Colors.Transparent;
|
|
|
|
|
|
|
|
|
|
string colorstring = (string)value;
|
|
|
|
|
string? colorstring = (string)value;
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrWhiteSpace(colorstring)) return Colors.Transparent;
|
|
|
|
|
|
|
|
|
@ -33,17 +33,17 @@ namespace Qwirkle.Converters
|
|
|
|
|
|
|
|
|
|
public class RoundToVisibilityConverter : IValueConverter
|
|
|
|
|
{
|
|
|
|
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
|
|
|
|
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
|
|
|
|
{
|
|
|
|
|
if (value is not string)
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
string sh = (string)value;
|
|
|
|
|
string? sh = (string)value;
|
|
|
|
|
|
|
|
|
|
return sh == "Round";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
|
|
|
|
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
|
|
|
|
|
{
|
|
|
|
|
throw new NotSupportedException();
|
|
|
|
|
}
|
|
|
|
@ -51,17 +51,17 @@ namespace Qwirkle.Converters
|
|
|
|
|
|
|
|
|
|
public class RhombusToVisibilityConverter : IValueConverter
|
|
|
|
|
{
|
|
|
|
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
|
|
|
|
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
|
|
|
|
{
|
|
|
|
|
if (value is not string)
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
string sh = (string)value;
|
|
|
|
|
string? sh = (string)value;
|
|
|
|
|
|
|
|
|
|
return sh == "Rhombus";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
|
|
|
|
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
|
|
|
|
|
{
|
|
|
|
|
throw new NotSupportedException();
|
|
|
|
|
}
|
|
|
|
@ -69,17 +69,17 @@ namespace Qwirkle.Converters
|
|
|
|
|
|
|
|
|
|
public class SquareToVisibilityConverter : IValueConverter
|
|
|
|
|
{
|
|
|
|
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
|
|
|
|
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
|
|
|
|
{
|
|
|
|
|
if (value is not string)
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
string sh = (string)value;
|
|
|
|
|
string? sh = (string)value;
|
|
|
|
|
|
|
|
|
|
return sh == "Square";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
|
|
|
|
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
|
|
|
|
|
{
|
|
|
|
|
throw new NotSupportedException();
|
|
|
|
|
}
|
|
|
|
@ -87,17 +87,17 @@ namespace Qwirkle.Converters
|
|
|
|
|
|
|
|
|
|
public class ClubToVisibilityConverter : IValueConverter
|
|
|
|
|
{
|
|
|
|
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
|
|
|
|
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
|
|
|
|
{
|
|
|
|
|
if (value is not string)
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
string sh = (string)value;
|
|
|
|
|
string? sh = (string)value;
|
|
|
|
|
|
|
|
|
|
return sh == "Club";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
|
|
|
|
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
|
|
|
|
|
{
|
|
|
|
|
throw new NotSupportedException();
|
|
|
|
|
}
|
|
|
|
@ -105,17 +105,17 @@ namespace Qwirkle.Converters
|
|
|
|
|
|
|
|
|
|
public class ShurikenToVisibilityConverter : IValueConverter
|
|
|
|
|
{
|
|
|
|
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
|
|
|
|
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
|
|
|
|
{
|
|
|
|
|
if (value is not string)
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
string sh = (string)value;
|
|
|
|
|
string? sh = (string)value;
|
|
|
|
|
|
|
|
|
|
return sh == "Shuriken";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
|
|
|
|
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
|
|
|
|
|
{
|
|
|
|
|
throw new NotSupportedException();
|
|
|
|
|
}
|
|
|
|
@ -123,12 +123,12 @@ namespace Qwirkle.Converters
|
|
|
|
|
|
|
|
|
|
public class StarToVisibilityConverter : IValueConverter
|
|
|
|
|
{
|
|
|
|
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
|
|
|
|
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
|
|
|
|
{
|
|
|
|
|
if (value is not string)
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
string sh = (string)value;
|
|
|
|
|
string? sh = (string)value;
|
|
|
|
|
|
|
|
|
|
return sh == "Star";
|
|
|
|
|
}
|
|
|
|
|