using System;
using CommunityToolkit.Mvvm.DependencyInjection;
using StrixMusic.Sdk.WinUI.Services.Localization;
using Windows.UI.Xaml.Data;
namespace StrixMusic.Sdk.WinUI.Converters.Units
{
///
/// A converter that adds a "Playlists" suffix to a unit.
///
public sealed class CountToPlaylistsConverter : IValueConverter
{
///
/// Adds a "Playlists" suffix to a unit.
///
/// The to convert
/// The converted value.
public static string Convert(int value)
{
var localizationService = Ioc.Default.GetService();
return localizationService?.Music is null ?
value.ToString() :
string.Format(localizationService.Music.GetString("PlaylistsCount"), value);
}
///
public object Convert(object value, Type targetType, object parameter, string language)
{
return Convert((int)value);
}
///
public object ConvertBack(object value, Type targetType, object parameter, string language)
{
throw new NotImplementedException();
}
}
}