Initial work for AbstractUI options

This commit is contained in:
Yoshi Askharoun
2021-08-05 20:45:26 -05:00
parent ba28eb7ef7
commit 3e3228245d
63 changed files with 2392 additions and 68 deletions
@@ -0,0 +1,40 @@
using System;
using System.Diagnostics.Contracts;
using System.Globalization;
using System.Runtime.CompilerServices;
using System.Windows.Data;
namespace OwlCore.Wpf.Converters.Time.Numerical
{
/// <summary>
/// A converter that converts a given <see cref="long"/> to a <see cref="TimeSpan"/>.
/// </summary>
public sealed class DoubleToTimeSpanConverter : IValueConverter
{
/// <summary>
/// Converts a <see cref="long"/> to a <see cref="TimeSpan"/>.
/// </summary>
/// <param name="value">The <see cref="TimeSpan"/> to convert.</param>
/// <returns>A formatted string of the <see cref="TimeSpan"/>.</returns>
[Pure]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TimeSpan Convert(double value) => TimeSpan.FromMilliseconds(value);
/// <inheritdoc/>
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is double timeSpan)
{
return Convert(timeSpan);
}
return Convert(0);
}
/// <inheritdoc/>
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}