using System;
using System.Diagnostics.Contracts;
using System.Runtime.CompilerServices;
using Windows.UI.Xaml.Data;
namespace OwlCore.WinUI.Converters.Time.Numerical
{
///
/// A converter that converts a given to a then to a natural time format string.
///
public sealed class LongToTimeSpanTextConverter : IValueConverter
{
///
/// Converts a to a formatted string.
///
/// The to convert.
/// A formatted string of the as a .
[Pure]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static string Convert(long value) => TimeSpanToTextConverter.Convert(LongToTimeSpanConverter.Convert(value));
///
public object Convert(object value, Type targetType, object parameter, string language)
{
long lValue = 0;
switch (value)
{
case long l:
lValue = l;
break;
case double d:
lValue = (long)d;
break;
case int i:
lValue = i;
break;
case float f:
lValue = (long)f;
break;
}
return Convert(lValue);
}
///
public object ConvertBack(object value, Type targetType, object parameter, string language)
{
throw new NotImplementedException();
}
}
}