Avoid audio cover null exception in xaml

Can slightly increase the opening speed of audio file
This commit is contained in:
ema
2025-05-24 05:41:38 +08:00
parent eff9d795f0
commit c2acdaa182
2 changed files with 21 additions and 12 deletions

View File

@@ -19,6 +19,7 @@ using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
using System.Windows.Media.Imaging;
namespace QuickLook.Plugin.VideoViewer;
@@ -48,7 +49,7 @@ public sealed class TimeTickToShortStringConverter : DependencyObject, IValueCon
public sealed class VolumeToIconConverter : DependencyObject, IValueConverter
{
private static readonly string[] Volumes = { "\xE74F", "\xE993", "\xE994", "\xE995" };
private static readonly string[] Volumes = ["\xE74F", "\xE993", "\xE994", "\xE995"];
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
@@ -69,3 +70,19 @@ public sealed class VolumeToIconConverter : DependencyObject, IValueConverter
throw new NotImplementedException();
}
}
public sealed class CoverArtConverter : IValueConverter
{
private static readonly BitmapImage emptyImage =
new(new Uri("pack://application:,,,/QuickLook.Plugin.VideoViewer;component/Resources/empty.png", UriKind.Absolute));
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return value ?? emptyImage;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}