mirror of
https://github.com/jayfunc/BetterLyrics.git
synced 2026-01-12 02:44:56 +08:00
- Add album text in lyrics render - Improve song info update and draw algo - Upgrade to .NET 10
27 lines
846 B
C#
27 lines
846 B
C#
using Microsoft.UI.Xaml.Data;
|
|
using System;
|
|
|
|
namespace BetterLyrics.WinUI3.Converter
|
|
{
|
|
public class MillisecondsToFormattedTimeConverter : IValueConverter
|
|
{
|
|
public object Convert(object value, Type targetType, object parameter, string language)
|
|
{
|
|
if (value is int milliseconds)
|
|
{
|
|
return TimeSpan.FromMilliseconds(milliseconds).ToString(@"mm\:ss\.fff");
|
|
}
|
|
else if (value is double doubleMilliseconds)
|
|
{
|
|
return TimeSpan.FromMilliseconds(doubleMilliseconds).ToString(@"mm\:ss\.fff");
|
|
}
|
|
return value?.ToString() ?? "";
|
|
}
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, string language)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
}
|
|
}
|