BattlelogMobile.Client.Converter.TimeSpanStringConverter.Convert C# (CSharp) Method

Convert() public method

public Convert ( object value, Type targetType, object parameter, CultureInfo culture ) : object
value object
targetType System.Type
parameter object
culture System.Globalization.CultureInfo
return object
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value == null || !(value is TimeSpan))
                return string.Empty;

            var span = (TimeSpan)value;

            if (parameter == null || string.CompareOrdinal(parameter.ToString(), "full") != 0)
                return FormatAsHoursAndMinutes(span);
            return FormatAsCompleteUnits(span);
        }