mirror of
https://github.com/ZuneDev/ZuneModdingHelper.git
synced 2026-07-27 13:12:21 -07:00
Initial work for AbstractUI options
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user