diff --git a/src/Snap.Hutao/Snap.Hutao/App.xaml.cs b/src/Snap.Hutao/Snap.Hutao/App.xaml.cs index c1d79aa1..9e040829 100644 --- a/src/Snap.Hutao/Snap.Hutao/App.xaml.cs +++ b/src/Snap.Hutao/Snap.Hutao/App.xaml.cs @@ -48,6 +48,8 @@ public sealed partial class App : Application /// 服务提供器 public App(IServiceProvider serviceProvider) { + // DispatcherShutdownMode = DispatcherShutdownMode.OnExplicitShutdown; + // Load app resource InitializeComponent(); activation = serviceProvider.GetRequiredService(); diff --git a/src/Snap.Hutao/Snap.Hutao/IdentifyMonitorWindow.xaml.cs b/src/Snap.Hutao/Snap.Hutao/IdentifyMonitorWindow.xaml.cs index 604697b2..afbbeb6d 100644 --- a/src/Snap.Hutao/Snap.Hutao/IdentifyMonitorWindow.xaml.cs +++ b/src/Snap.Hutao/Snap.Hutao/IdentifyMonitorWindow.xaml.cs @@ -32,6 +32,7 @@ internal sealed partial class IdentifyMonitorWindow : Window { List windows = []; + // TODO: the order here is not sync with unity. IReadOnlyList displayAreas = DisplayArea.FindAll(); for (int i = 0; i < displayAreas.Count; i++) { diff --git a/src/Snap.Hutao/Snap.Hutao/Service/Game/Automation/ScreenCapture/GameScreenCaptureService.cs b/src/Snap.Hutao/Snap.Hutao/Service/Game/Automation/ScreenCapture/GameScreenCaptureService.cs index b1d4376e..0f1367f2 100644 --- a/src/Snap.Hutao/Snap.Hutao/Service/Game/Automation/ScreenCapture/GameScreenCaptureService.cs +++ b/src/Snap.Hutao/Snap.Hutao/Service/Game/Automation/ScreenCapture/GameScreenCaptureService.cs @@ -17,7 +17,8 @@ using static Snap.Hutao.Win32.Macros; namespace Snap.Hutao.Service.Game.Automation.ScreenCapture; [ConstructorGenerated] -internal sealed partial class GameScreenCaptureService +[Injection(InjectAs.Singleton, typeof(IGameScreenCaptureService))] +internal sealed partial class GameScreenCaptureService : IGameScreenCaptureService { private readonly ILogger logger; diff --git a/src/Snap.Hutao/Snap.Hutao/Service/Game/Automation/ScreenCapture/IGameScreenCaptureService.cs b/src/Snap.Hutao/Snap.Hutao/Service/Game/Automation/ScreenCapture/IGameScreenCaptureService.cs new file mode 100644 index 00000000..84aefae5 --- /dev/null +++ b/src/Snap.Hutao/Snap.Hutao/Service/Game/Automation/ScreenCapture/IGameScreenCaptureService.cs @@ -0,0 +1,13 @@ +// Copyright (c) DGP Studio. All rights reserved. +// Licensed under the MIT license. + +using Snap.Hutao.Win32.Foundation; + +namespace Snap.Hutao.Service.Game.Automation.ScreenCapture; + +internal interface IGameScreenCaptureService +{ + bool IsSupported(); + + bool TryStartCapture(HWND hwnd, [NotNullWhen(true)] out GameScreenCaptureSession? session); +} \ No newline at end of file