You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
944 B

using AMC.View.Resources.Strings;
using System.Globalization;
namespace AMC.View.Converters
{
public class SongsInfoConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
var (songCount, totalDuration) = (ValueTuple<int, int>)value;
var songLabel = songCount == 1 ? Strings.SongsLabelSingular : Strings.SongsLabelPlural;
var minutesLabel = totalDuration == 1 ? Strings.MinutesLabelSingular : Strings.MinutesLabelPlural;
return string.Format(
"{0} {1}, {2} {3}",
songCount,
songLabel,
totalDuration,
minutesLabel
);
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}