mirror of
https://github.com/jayfunc/BetterLyrics.git
synced 2026-01-12 10:54:55 +08:00
- Add album text in lyrics render - Improve song info update and draw algo - Upgrade to .NET 10
34 lines
1.4 KiB
C#
34 lines
1.4 KiB
C#
using BetterLyrics.WinUI3.Enums;
|
|
using BetterLyrics.WinUI3.Services.ResourceService;
|
|
using CommunityToolkit.Mvvm.DependencyInjection;
|
|
using Microsoft.UI.Xaml.Data;
|
|
using System;
|
|
|
|
namespace BetterLyrics.WinUI3.Converter
|
|
{
|
|
public partial class AlbumArtSearchProviderToDisplayNameConverter : IValueConverter
|
|
{
|
|
private readonly IResourceService _resourceService = Ioc.Default.GetRequiredService<IResourceService>();
|
|
|
|
public object Convert(object value, Type targetType, object parameter, string language)
|
|
{
|
|
if (value is AlbumArtSearchProvider provider)
|
|
{
|
|
return provider switch
|
|
{
|
|
AlbumArtSearchProvider.Local => _resourceService.GetLocalizedString("AlbumArtSearchLocalProvider"),
|
|
AlbumArtSearchProvider.SMTC => _resourceService.GetLocalizedString("AlbumArtSearchSMTCProvider"),
|
|
AlbumArtSearchProvider.iTunes => "iTunes",
|
|
_ => throw new Exception($"Unknown AlbumArtSearchProvider: {provider}"),
|
|
};
|
|
}
|
|
throw new ArgumentException("Value must be of type AlbumArtSearchProvider", nameof(value));
|
|
}
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, string language)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
}
|
|
}
|