Ejemplo n.º 1
0
 /// <inheritdoc/>
 public override object Convert(object value, Type targetType, object parameter, CultureInfo culture)
 {
     return(targetType == typeof(double) ? ConverterHelper.ConvertToDouble(value, culture) : ConverterHelper.TryConvertToDouble(value, culture));
 }
Ejemplo n.º 2
0
        /// <inheritdoc/>
        public override object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var doubleValue = targetType == typeof(AngleSingle) ? ConverterHelper.ConvertToDouble(value, culture) : ConverterHelper.TryConvertToDouble(value, culture);

            return(doubleValue != null ? (object)new AngleSingle((float)doubleValue.Value, AngleType.Degree) : null);
        }
Ejemplo n.º 3
0
        /// <inheritdoc/>
        public override object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var doubleValue = targetType == typeof(TimeSpan) ? ConverterHelper.ConvertToDouble(value, culture) : ConverterHelper.TryConvertToDouble(value, culture);

            return(doubleValue != null ? (object)TimeSpan.FromSeconds(doubleValue.Value) : null);
        }