mirror of
https://github.com/jayfunc/BetterLyrics.git
synced 2026-01-13 03:34:55 +08:00
32 lines
902 B
C#
32 lines
902 B
C#
using BetterLyrics.WinUI3.Helper;
|
|
using Microsoft.UI.Xaml.Data;
|
|
using Microsoft.UI.Xaml.Media.Imaging;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Text;
|
|
|
|
namespace BetterLyrics.WinUI3.Converter
|
|
{
|
|
public partial class PathToImageConverter : IValueConverter
|
|
{
|
|
public object Convert(object value, Type targetType, object parameter, string language)
|
|
{
|
|
string targetPath = PathHelper.AlbumArtPlaceholderPath;
|
|
if (value is string path)
|
|
{
|
|
if (File.Exists(path))
|
|
{
|
|
targetPath = path;
|
|
}
|
|
}
|
|
return new BitmapImage(new Uri(targetPath));
|
|
}
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, string language)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
}
|
|
}
|