26 lines
637 B
C#
26 lines
637 B
C#
using Harmonia.Core.Models;
|
|
using Microsoft.UI.Xaml.Data;
|
|
using System;
|
|
|
|
namespace Harmonia.WinUI.Converters;
|
|
|
|
public sealed partial class SongTitleConverter : IValueConverter
|
|
{
|
|
public SongTitleConverter()
|
|
{
|
|
|
|
}
|
|
|
|
public object? Convert(object value, Type targetType, object parameter, string language)
|
|
{
|
|
if (value is not Song song)
|
|
return null;
|
|
|
|
return string.IsNullOrWhiteSpace(song.Title) ? song.ShortFileName : song.Title;
|
|
}
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, string language)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
} |