移除winforms引用

This commit is contained in:
ww-rm
2025-05-29 20:10:15 +08:00
parent fffe69c49f
commit 42cb782a96
18 changed files with 111 additions and 146 deletions

View File

@@ -12,6 +12,7 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows;
namespace SpineViewer.ViewModels
{
public class DiagnosticsDialogViewModel : ObservableObject
@@ -31,7 +32,20 @@ namespace SpineViewer.ViewModels
}
}
public string Memory => $"{new Microsoft.VisualBasic.Devices.ComputerInfo().TotalPhysicalMemory / 1024f / 1024f / 1024f:F1} GB";
public string Memory
{
get
{
var searcher = new ManagementObjectSearcher("SELECT TotalPhysicalMemory FROM Win32_ComputerSystem");
foreach (ManagementObject obj in searcher.Get())
{
ulong bytes = (ulong)obj["TotalPhysicalMemory"];
float gb = bytes / 1024f / 1024f / 1024f;
return $"{gb:F1} GB";
}
return "N/A";
}
}
public string WindowsVersion
{

View File

@@ -50,7 +50,7 @@ namespace SpineViewer.ViewModels.Exporters
protected override void Export_Execute(IList? args)
{
if (args is null || args.Count <= 0) return;
if (!ExporterDialogService.ShowCustomFFmpegExporterDialog(this)) return;
if (!DialogService.ShowCustomFFmpegExporterDialog(this)) return;
SpineObject[] spines = args.Cast<SpineObjectModel>().Select(m => m.GetSpineObject()).ToArray();
ProgressService.RunAsync((pr, ct) => ExportTask(spines, pr, ct), AppResource.Str_CustomFFmpegExporterTitle);
foreach (var sp in spines) sp.Dispose();

View File

@@ -37,7 +37,7 @@ namespace SpineViewer.ViewModels.Exporters
protected override void Export_Execute(IList? args)
{
if (args is null || args.Count <= 0) return;
if (!ExporterDialogService.ShowFFmpegVideoExporterDialog(this)) return;
if (!DialogService.ShowFFmpegVideoExporterDialog(this)) return;
SpineObject[] spines = args.Cast<SpineObjectModel>().Select(m => m.GetSpineObject()).ToArray();
ProgressService.RunAsync((pr, ct) => ExportTask(spines, pr, ct), AppResource.Str_FFmpegVideoExporterTitle);
foreach (var sp in spines) sp.Dispose();

View File

@@ -41,7 +41,7 @@ namespace SpineViewer.ViewModels.Exporters
protected override void Export_Execute(IList? args)
{
if (args is null || args.Count <= 0) return;
if (!ExporterDialogService.ShowFrameExporterDialog(this)) return;
if (!DialogService.ShowFrameExporterDialog(this)) return;
SpineObject[] spines = args.Cast<SpineObjectModel>().Select(m => m.GetSpineObject(true)).ToArray();
ProgressService.RunAsync((pr, ct) => ExportTask(spines, pr, ct), AppResource.Str_FrameExporterTitle);
foreach (var sp in spines) sp.Dispose();

View File

@@ -20,7 +20,7 @@ namespace SpineViewer.ViewModels.Exporters
protected override void Export_Execute(IList? args)
{
if (args is null || args.Count <= 0) return;
if (!ExporterDialogService.ShowFrameSequenceExporterDialog(this)) return;
if (!DialogService.ShowFrameSequenceExporterDialog(this)) return;
SpineObject[] spines = args.Cast<SpineObjectModel>().Select(m => m.GetSpineObject()).ToArray();
ProgressService.RunAsync((pr, ct) => ExportTask(spines, pr, ct), AppResource.Str_FrameSequenceExporterTitle);
foreach (var sp in spines) sp.Dispose();

View File

@@ -94,7 +94,7 @@ namespace SpineViewer.ViewModels.MainWindow
/// </summary>
public RelayCommand Cmd_ChangeCurrentDirectory => _cmd_ChangeCurrentDirectory ??= new(() =>
{
if (OpenFolderService.OpenFolder(out var selectedPath))
if (DialogService.ShowOpenFolderDialog(out var selectedPath))
{
_currentDirectory = selectedPath;
RefreshItems();

View File

@@ -83,13 +83,13 @@ namespace SpineViewer.ViewModels.MainWindow
/// <summary>
/// 显示诊断信息对话框
/// </summary>
public RelayCommand Cmd_ShowDiagnosticsDialog => _cmd_ShowDiagnosticsDialog ??= new(() => { DiagnosticsDialogService.ShowDiagnosticsDialog(); });
public RelayCommand Cmd_ShowDiagnosticsDialog => _cmd_ShowDiagnosticsDialog ??= new(() => { DialogService.ShowDiagnosticsDialog(); });
private RelayCommand? _cmd_ShowDiagnosticsDialog;
/// <summary>
/// 显示关于对话框
/// </summary>
public RelayCommand Cmd_ShowAboutDialog => _cmd_ShowAboutDialog ??= new(() => { AboutDialogService.ShowAboutDialog(); });
public RelayCommand Cmd_ShowAboutDialog => _cmd_ShowAboutDialog ??= new(() => { DialogService.ShowAboutDialog(); });
private RelayCommand? _cmd_ShowAboutDialog;
/// <summary>