diff --git a/src/Snap.Hutao/.editorconfig b/src/Snap.Hutao/.editorconfig
index 0bd4841e..d3d7c0b4 100644
--- a/src/Snap.Hutao/.editorconfig
+++ b/src/Snap.Hutao/.editorconfig
@@ -124,9 +124,6 @@ dotnet_diagnostic.SA1623.severity = none
# SA1636: File header copyright text should match
dotnet_diagnostic.SA1636.severity = none
-# SA1414: Tuple types in signatures should have element names
-dotnet_diagnostic.SA1414.severity = none
-
# SA0001: XML comment analysis disabled
dotnet_diagnostic.SA0001.severity = none
csharp_style_prefer_parameter_null_checking = true:suggestion
@@ -325,7 +322,6 @@ dotnet_diagnostic.CA2227.severity = suggestion
# CA2251: 使用 “string.Equals”
dotnet_diagnostic.CA2251.severity = suggestion
csharp_style_prefer_primary_constructors = true:suggestion
-dotnet_diagnostic.SA1010.severity = none
[*.vb]
#### 命名样式 ####
diff --git a/src/Snap.Hutao/Snap.Hutao/Core/StructMarshal.cs b/src/Snap.Hutao/Snap.Hutao/Core/StructMarshal.cs
index 1bc1dada..ec373b45 100644
--- a/src/Snap.Hutao/Snap.Hutao/Core/StructMarshal.cs
+++ b/src/Snap.Hutao/Snap.Hutao/Core/StructMarshal.cs
@@ -69,4 +69,9 @@ internal static class StructMarshal
{
return new(point.X, point.Y, size.Width, size.Height);
}
+
+ public static SizeInt32 SizeInt32(RectInt32 rect)
+ {
+ return new(rect.Width, rect.Height);
+ }
}
\ No newline at end of file
diff --git a/src/Snap.Hutao/Snap.Hutao/IdentifyMonitorWindow.xaml b/src/Snap.Hutao/Snap.Hutao/IdentifyMonitorWindow.xaml
index cb0b87b8..38bce5af 100644
--- a/src/Snap.Hutao/Snap.Hutao/IdentifyMonitorWindow.xaml
+++ b/src/Snap.Hutao/Snap.Hutao/IdentifyMonitorWindow.xaml
@@ -6,12 +6,14 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:shcm="using:Snap.Hutao.Control.Markup"
mc:Ignorable="d">
-
-
+
+
-
+
\ No newline at end of file
diff --git a/src/Snap.Hutao/Snap.Hutao/IdentifyMonitorWindow.xaml.cs b/src/Snap.Hutao/Snap.Hutao/IdentifyMonitorWindow.xaml.cs
index 3094e5a4..26138081 100644
--- a/src/Snap.Hutao/Snap.Hutao/IdentifyMonitorWindow.xaml.cs
+++ b/src/Snap.Hutao/Snap.Hutao/IdentifyMonitorWindow.xaml.cs
@@ -1,17 +1,29 @@
// Copyright (c) DGP Studio. All rights reserved.
// Licensed under the MIT license.
+using Microsoft.UI.Windowing;
using Microsoft.UI.Xaml;
+using Snap.Hutao.Core;
+using Windows.Graphics;
namespace Snap.Hutao;
internal sealed partial class IdentifyMonitorWindow : Window
{
- public IdentifyMonitorWindow(string monitor)
+ public IdentifyMonitorWindow(DisplayArea displayArea, int index)
{
InitializeComponent();
+ Monitor = $"{displayArea.DisplayId.Value:X8}:{index}";
- Monitor = monitor;
+ OverlappedPresenter presenter = OverlappedPresenter.Create();
+ presenter.SetBorderAndTitleBar(false, false);
+ presenter.IsAlwaysOnTop = true;
+ presenter.IsResizable = false;
+ AppWindow.SetPresenter(presenter);
+
+ PointInt32 point = new(40, 32);
+ SizeInt32 size = StructMarshal.SizeInt32(displayArea.WorkArea).Scale(0.1);
+ AppWindow.MoveAndResize(StructMarshal.RectInt32(point, size), displayArea);
}
public string Monitor { get; private set; }
diff --git a/src/Snap.Hutao/Snap.Hutao/Resource/Localization/SH.resx b/src/Snap.Hutao/Snap.Hutao/Resource/Localization/SH.resx
index 4e5cb31c..5d685054 100644
--- a/src/Snap.Hutao/Snap.Hutao/Resource/Localization/SH.resx
+++ b/src/Snap.Hutao/Snap.Hutao/Resource/Localization/SH.resx
@@ -1358,9 +1358,6 @@
深渊统计
-
- 当前显示器为:
-
有新的通知
@@ -2972,4 +2969,7 @@
[{0}] 中的 [{1}] 网络请求异常,请稍后再试
+
+ 显示器编号
+
\ No newline at end of file
diff --git a/src/Snap.Hutao/Snap.Hutao/Snap.Hutao.csproj b/src/Snap.Hutao/Snap.Hutao/Snap.Hutao.csproj
index f54f4cea..c08fbb5f 100644
--- a/src/Snap.Hutao/Snap.Hutao/Snap.Hutao.csproj
+++ b/src/Snap.Hutao/Snap.Hutao/Snap.Hutao.csproj
@@ -322,7 +322,7 @@
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
diff --git a/src/Snap.Hutao/Snap.Hutao/View/Page/LaunchGamePage.xaml b/src/Snap.Hutao/Snap.Hutao/View/Page/LaunchGamePage.xaml
index 819fe3bb..0d1252a2 100644
--- a/src/Snap.Hutao/Snap.Hutao/View/Page/LaunchGamePage.xaml
+++ b/src/Snap.Hutao/Snap.Hutao/View/Page/LaunchGamePage.xaml
@@ -228,7 +228,7 @@
-
+
-
+
displayAreas = DisplayArea.FindAll();
for (int i = 0; i < displayAreas.Count; i++)
{
- DisplayArea displayArea = displayAreas[i];
- int index = i + 1;
-
- // Refresh thread to avoid access violation
- await taskContext.SwitchToBackgroundAsync();
- await taskContext.SwitchToMainThreadAsync();
- IdentifyMonitorWindow window = new($"{displayArea.DisplayId.Value:X8}:{index}");
- AppWindow appWindow = window.AppWindow;
-
- OverlappedPresenter presenter = OverlappedPresenter.Create();
- presenter.SetBorderAndTitleBar(false, false);
- presenter.IsAlwaysOnTop = true;
- appWindow.SetPresenter(presenter);
-
- SizeInt32 size = new((int)(displayArea.WorkArea.Width * 0.15), (int)(displayArea.WorkArea.Height * 0.15));
- PointInt32 point = new(displayArea.WorkArea.X, displayArea.WorkArea.Y);
- appWindow.Resize(size);
- appWindow.Move(point);
-
- window.Activate();
-
- windows.Add(window);
+ windows.Add(new IdentifyMonitorWindow(displayAreas[i], i + 1));
}
- await Delay.FromSeconds(3).ConfigureAwait(false);
+ foreach (IdentifyMonitorWindow window in windows)
+ {
+ window.Activate();
+ }
- await taskContext.SwitchToMainThreadAsync();
- windows.ForEach(window => window.Close());
+ await Delay.FromSeconds(3).ConfigureAwait(true);
+
+ foreach (IdentifyMonitorWindow window in windows)
+ {
+ window.Close();
+ }
}
}
\ No newline at end of file