in System.Numerics/SIMD/Mandelbrot/WPFHelpers.cs [22:42]
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
Visibility trueVal = (parameter == null) ? Visibility.Visible : Visibility.Collapsed;
Visibility falseVal = (parameter == null) ? Visibility.Collapsed : Visibility.Visible;
if (targetType == typeof(Visibility))
{
if (value is bool)
return (bool)value ? trueVal : falseVal;
else if (value is int)
return ((int)value != 0) ? trueVal : falseVal;
else if (value is double)
// Should be Double.Epsilon, but that number is wrong (it's a denormal)
return (Math.Abs((double)value) >= 1e-10) ? trueVal : falseVal;
// If it's not one of those types, fall thru to NotImpl...
}
else if (targetType == typeof(bool) && value is Visibility)
{
return ((Visibility)value) == trueVal;
}
throw new NotImplementedException();
}