feat: 暴露清理方法

This commit is contained in:
2026-06-09 20:14:32 +08:00
parent fb1bd066f5
commit 5ab48c4db6
3 changed files with 10 additions and 1 deletions
+1 -1
View File
@@ -29,7 +29,7 @@
- [ ] 扫描时如果报错,报错信息可能会填满整个窗口,导致Overlay无法关闭。 - [ ] 扫描时如果报错,报错信息可能会填满整个窗口,导致Overlay无法关闭。
- [ ] 读取时如果报错,没有任何警告,会静默报错。需要有一个界面右下方的toast,或是发送系统通知告知用户遇到了错误。 - [ ] 读取时如果报错,没有任何警告,会静默报错。需要有一个界面右下方的toast,或是发送系统通知告知用户遇到了错误。
- [ ] 指针化Artwork字段。如果artwork的md5 - [x] 指针化Artwork字段。如果artwork的md5
- [ ] 本地化框架 - [ ] 本地化框架
## 技术栈 ## 技术栈
@@ -1,4 +1,5 @@
using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using GUI.Services; using GUI.Services;
namespace GUI.ViewModels; namespace GUI.ViewModels;
@@ -60,4 +61,11 @@ public partial class MainWindowViewModel : ViewModelBase
IsScanning = true; IsScanning = true;
ScanProgressVM.StartScanCommand.Execute(directory); ScanProgressVM.StartScanCommand.Execute(directory);
} }
[RelayCommand]
private void CleanOrphanedArtwork()
{
int count = OCES.Resonance.Core.Database.DeleteOrphanedArtworks();
// TODO: 添加用户提示,例如对话框显示 "已清理 {count} 条未使用的资源"
}
} }
+1
View File
@@ -21,6 +21,7 @@
<NativeMenu> <NativeMenu>
<NativeMenuItem Header="Database" IsVisible="True"> <NativeMenuItem Header="Database" IsVisible="True">
<NativeMenu> <NativeMenu>
<NativeMenuItem Header="Delete Unused Artworks" Command="{Binding CleanOrphanedArtworkCommand}"></NativeMenuItem>
<NativeMenuItem Header="Open database file in Finder..."/> <NativeMenuItem Header="Open database file in Finder..."/>
</NativeMenu> </NativeMenu>
</NativeMenuItem> </NativeMenuItem>