Refactor MoreMenuProvider into Plugin partial class

This commit is contained in:
ema
2025-09-24 23:37:29 +08:00
parent 2317fad8e3
commit 4fa57b70ba
2 changed files with 5 additions and 8 deletions

View File

@@ -18,24 +18,21 @@
using QuickLook.Common.Commands;
using QuickLook.Common.Helpers;
using QuickLook.Common.Plugin.MoreMenu;
using System;
using System.Collections.Generic;
using System.Windows.Input;
namespace QuickLook.Plugin.MediaInfoViewer;
public sealed class MoreMenuProvider
public partial class Plugin
{
public static Lazy<MoreMenuProvider> Instance { get; set; } = new(() => new());
public ICommand ShowWithMediaInfoCommand { get; }
public MoreMenuProvider()
public Plugin()
{
ShowWithMediaInfoCommand = new RelayCommand(ShowWithMediaInfo);
}
public IEnumerable<IMenuItem> Get()
public IEnumerable<IMenuItem> GetMenuItems()
{
yield return new MoreMenuItem()
{

View File

@@ -28,13 +28,13 @@ using System.Windows.Media;
namespace QuickLook.Plugin.MediaInfoViewer;
public class Plugin : IViewer, IMoreMenuExtended
public partial class Plugin : IViewer, IMoreMenuExtended
{
private TextViewerPanel _tvp;
public int Priority => 0;
public IEnumerable<IMenuItem> MenuItems => MoreMenuProvider.Instance.Value.Get();
public IEnumerable<IMenuItem> MenuItems => GetMenuItems();
public void Init()
{