Merge pull request #1273 from DGP-Studio/feat/identify_monitor

This commit is contained in:
DismissedLight
2024-01-06 23:39:41 +08:00
committed by GitHub
12 changed files with 138 additions and 39 deletions

View File

@@ -124,9 +124,6 @@ dotnet_diagnostic.SA1623.severity = none
# SA1636: File header copyright text should match # SA1636: File header copyright text should match
dotnet_diagnostic.SA1636.severity = none dotnet_diagnostic.SA1636.severity = none
# SA1414: Tuple types in signatures should have element names
dotnet_diagnostic.SA1414.severity = none
# SA0001: XML comment analysis disabled # SA0001: XML comment analysis disabled
dotnet_diagnostic.SA0001.severity = none dotnet_diagnostic.SA0001.severity = none
csharp_style_prefer_parameter_null_checking = true:suggestion csharp_style_prefer_parameter_null_checking = true:suggestion
@@ -325,7 +322,6 @@ dotnet_diagnostic.CA2227.severity = suggestion
# CA2251: 使用 “string.Equals” # CA2251: 使用 “string.Equals”
dotnet_diagnostic.CA2251.severity = suggestion dotnet_diagnostic.CA2251.severity = suggestion
csharp_style_prefer_primary_constructors = true:suggestion csharp_style_prefer_primary_constructors = true:suggestion
dotnet_diagnostic.SA1010.severity = none
[*.vb] [*.vb]
#### 命名样式 #### #### 命名样式 ####

View File

@@ -6,6 +6,11 @@
<x:Double x:Key="SettingsCardWrapNoIconThreshold">0</x:Double> <x:Double x:Key="SettingsCardWrapNoIconThreshold">0</x:Double>
<x:Double x:Key="SettingsCardContentControlMinWidth">120</x:Double> <x:Double x:Key="SettingsCardContentControlMinWidth">120</x:Double>
<x:Double x:Key="SettingsCardContentControlMinWidth2">160</x:Double>
<x:Double x:Key="SettingsCardContentControlSpacing">10</x:Double>
<Thickness x:Key="SettingsCardAlignSettingsExpanderPadding">16,16,44,16</Thickness>
<Style <Style
x:Key="SettingsSectionHeaderTextBlockStyle" x:Key="SettingsSectionHeaderTextBlockStyle"

View File

@@ -69,4 +69,9 @@ internal static class StructMarshal
{ {
return new(point.X, point.Y, size.Width, size.Height); return new(point.X, point.Y, size.Width, size.Height);
} }
public static SizeInt32 SizeInt32(RectInt32 rect)
{
return new(rect.Width, rect.Height);
}
} }

View File

@@ -8,12 +8,12 @@ internal readonly struct Delay
/// <summary> /// <summary>
/// 随机延迟 /// 随机延迟
/// </summary> /// </summary>
/// <param name="minMilliSeconds">最小,闭</param> /// <param name="min">最小,闭</param>
/// <param name="maxMilliSeconds">最小,开</param> /// <param name="max">最小,开</param>
/// <returns>任务</returns> /// <returns>任务</returns>
public static ValueTask Random(int minMilliSeconds, int maxMilliSeconds) public static ValueTask RandomMilliSeconds(int min, int max)
{ {
return Task.Delay((int)(System.Random.Shared.NextDouble() * (maxMilliSeconds - minMilliSeconds)) + minMilliSeconds).AsValueTask(); return Task.Delay((int)(System.Random.Shared.NextDouble() * (max - min)) + min).AsValueTask();
} }
public static ValueTask FromSeconds(int seconds) public static ValueTask FromSeconds(int seconds)

View File

@@ -0,0 +1,19 @@
<Window
x:Class="Snap.Hutao.IdentifyMonitorWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:shcm="using:Snap.Hutao.Control.Markup"
mc:Ignorable="d">
<StackPanel
HorizontalAlignment="Center"
VerticalAlignment="Center"
Spacing="3">
<TextBlock Text="{shcm:ResourceString Name=WindowIdentifyMonitorHeader}"/>
<TextBlock
Style="{StaticResource SubtitleTextBlockStyle}"
Text="{x:Bind Monitor}"
TextAlignment="Center"/>
</StackPanel>
</Window>

View File

@@ -0,0 +1,30 @@
// 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(DisplayArea displayArea, int index)
{
InitializeComponent();
Monitor = $"{displayArea.DisplayId.Value:X8}:{index}";
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; }
}

View File

@@ -1559,6 +1559,9 @@
<data name="ViewModelLaunchGameEnsureGameResourceFail" xml:space="preserve"> <data name="ViewModelLaunchGameEnsureGameResourceFail" xml:space="preserve">
<value>切换服务器失败</value> <value>切换服务器失败</value>
</data> </data>
<data name="ViewModelLaunchGameIdentifyMonitorsAction" xml:space="preserve">
<value>识别显示器</value>
</data>
<data name="ViewModelLaunchGameMultiChannelReadFail" xml:space="preserve"> <data name="ViewModelLaunchGameMultiChannelReadFail" xml:space="preserve">
<value>无法读取游戏配置文件: {0},可能是文件不存在或权限不足</value> <value>无法读取游戏配置文件: {0},可能是文件不存在或权限不足</value>
</data> </data>
@@ -2966,4 +2969,7 @@
<data name="WebResponseRequestExceptionFormat" xml:space="preserve"> <data name="WebResponseRequestExceptionFormat" xml:space="preserve">
<value>[{0}] 中的 [{1}] 网络请求异常,请稍后再试</value> <value>[{0}] 中的 [{1}] 网络请求异常,请稍后再试</value>
</data> </data>
<data name="WindowIdentifyMonitorHeader" xml:space="preserve">
<value>显示器编号</value>
</data>
</root> </root>

View File

@@ -226,7 +226,7 @@ internal sealed partial class GachaLogService : IGachaLogService
break; break;
} }
await Delay.Random(1000, 2000).ConfigureAwait(false); await Delay.RandomMilliSeconds(1000, 2000).ConfigureAwait(false);
} }
while (true); while (true);
@@ -238,7 +238,7 @@ internal sealed partial class GachaLogService : IGachaLogService
// save items for each queryType // save items for each queryType
token.ThrowIfCancellationRequested(); token.ThrowIfCancellationRequested();
fetchContext.SaveItems(); fetchContext.SaveItems();
await Delay.Random(1000, 2000).ConfigureAwait(false); await Delay.RandomMilliSeconds(1000, 2000).ConfigureAwait(false);
} }
return new(!fetchContext.FetchStatus.AuthKeyTimeout, fetchContext.TargetArchive); return new(!fetchContext.FetchStatus.AuthKeyTimeout, fetchContext.TargetArchive);

View File

@@ -218,8 +218,7 @@ internal sealed class LaunchOptions : DbStoreOptions
{ {
if (SetProperty(ref selectedAspectRatio, value) && value is AspectRatio aspectRatio) if (SetProperty(ref selectedAspectRatio, value) && value is AspectRatio aspectRatio)
{ {
ScreenWidth = (int)aspectRatio.Width; (ScreenWidth, ScreenHeight) = ((int)aspectRatio.Width, (int)aspectRatio.Height);
ScreenHeight = (int)aspectRatio.Height;
} }
} }
} }

View File

@@ -107,6 +107,7 @@
<None Remove="Control\Theme\Uri.xaml" /> <None Remove="Control\Theme\Uri.xaml" />
<None Remove="Control\Theme\WindowOverride.xaml" /> <None Remove="Control\Theme\WindowOverride.xaml" />
<None Remove="GuideWindow.xaml" /> <None Remove="GuideWindow.xaml" />
<None Remove="IdentifyMonitorWindow.xaml" />
<None Remove="IdentityStructs.json" /> <None Remove="IdentityStructs.json" />
<None Remove="LaunchGameWindow.xaml" /> <None Remove="LaunchGameWindow.xaml" />
<None Remove="Resource\BlurBackground.png" /> <None Remove="Resource\BlurBackground.png" />
@@ -321,7 +322,7 @@
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> </PackageReference>
<PackageReference Include="StyleCop.Analyzers.Unstable" Version="1.2.0.507"> <PackageReference Include="StyleCop.Analyzers.Unstable" Version="1.2.0.556">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> </PackageReference>
@@ -545,6 +546,12 @@
</Page> </Page>
</ItemGroup> </ItemGroup>
<ItemGroup>
<Page Update="IdentifyMonitorWindow.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup> <ItemGroup>
<Page Update="View\Control\HutaoStatisticsCard.xaml"> <Page Update="View\Control\HutaoStatisticsCard.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>

View File

@@ -171,8 +171,8 @@
Text="{shcm:ResourceString Name=ViewPageLaunchGameSwitchSchemeWarning}"/> Text="{shcm:ResourceString Name=ViewPageLaunchGameSwitchSchemeWarning}"/>
</StackPanel> </StackPanel>
</cwc:SettingsCard.Description> </cwc:SettingsCard.Description>
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal" Spacing="{ThemeResource SettingsCardContentControlSpacing}">
<shvc:Elevation Margin="0,0,36,0" Visibility="{Binding RuntimeOptions.IsElevated, Converter={StaticResource BoolToVisibilityRevertConverter}}"/> <shvc:Elevation Visibility="{Binding RuntimeOptions.IsElevated, Converter={StaticResource BoolToVisibilityRevertConverter}}"/>
<shc:SizeRestrictedContentControl> <shc:SizeRestrictedContentControl>
<shccs:ComboBox2 <shccs:ComboBox2
DisplayMemberPath="DisplayName" DisplayMemberPath="DisplayName"
@@ -203,7 +203,7 @@
Description="{shcm:ResourceString Name=ViewPageLaunchGameWindowsHDRDescription}" Description="{shcm:ResourceString Name=ViewPageLaunchGameWindowsHDRDescription}"
Header="{shcm:ResourceString Name=ViewPageLaunchGameWindowsHDRHeader}" Header="{shcm:ResourceString Name=ViewPageLaunchGameWindowsHDRHeader}"
HeaderIcon="{shcm:FontIcon Glyph=&#xE7F7;}"> HeaderIcon="{shcm:FontIcon Glyph=&#xE7F7;}">
<ToggleSwitch Width="120" IsOn="{Binding LaunchOptions.IsWindowsHDREnabled, Mode=TwoWay}"/> <ToggleSwitch MinWidth="{ThemeResource SettingsCardContentControlMinWidth}" IsOn="{Binding LaunchOptions.IsWindowsHDREnabled, Mode=TwoWay}"/>
</cwc:SettingsCard> </cwc:SettingsCard>
<!-- 进程 --> <!-- 进程 -->
@@ -213,81 +213,88 @@
Description="{shcm:ResourceString Name=ViewPageLaunchGameArgumentsDescription}" Description="{shcm:ResourceString Name=ViewPageLaunchGameArgumentsDescription}"
Header="{shcm:ResourceString Name=ViewPageLaunchGameArgumentsHeader}" Header="{shcm:ResourceString Name=ViewPageLaunchGameArgumentsHeader}"
HeaderIcon="{shcm:FontIcon Glyph=&#xE943;}"> HeaderIcon="{shcm:FontIcon Glyph=&#xE943;}">
<ToggleSwitch Width="120" IsOn="{Binding LaunchOptions.IsEnabled, Mode=TwoWay}"/> <ToggleSwitch MinWidth="{ThemeResource SettingsCardContentControlMinWidth}" IsOn="{Binding LaunchOptions.IsEnabled, Mode=TwoWay}"/>
<cwc:SettingsExpander.Items> <cwc:SettingsExpander.Items>
<cwc:SettingsCard Description="{shcm:ResourceString Name=ViewPageLaunchGameAppearanceExclusiveDescription}" Header="-window-mode exclusive"> <cwc:SettingsCard Description="{shcm:ResourceString Name=ViewPageLaunchGameAppearanceExclusiveDescription}" Header="-window-mode exclusive">
<ToggleSwitch Width="120" IsOn="{Binding LaunchOptions.IsExclusive, Mode=TwoWay}"/> <ToggleSwitch MinWidth="{ThemeResource SettingsCardContentControlMinWidth}" IsOn="{Binding LaunchOptions.IsExclusive, Mode=TwoWay}"/>
</cwc:SettingsCard> </cwc:SettingsCard>
<cwc:SettingsCard Description="{shcm:ResourceString Name=ViewPageLaunchGameAppearanceFullscreenDescription}" Header="-screen-fullscreen"> <cwc:SettingsCard Description="{shcm:ResourceString Name=ViewPageLaunchGameAppearanceFullscreenDescription}" Header="-screen-fullscreen">
<ToggleSwitch Width="120" IsOn="{Binding LaunchOptions.IsFullScreen, Mode=TwoWay}"/> <ToggleSwitch MinWidth="{ThemeResource SettingsCardContentControlMinWidth}" IsOn="{Binding LaunchOptions.IsFullScreen, Mode=TwoWay}"/>
</cwc:SettingsCard> </cwc:SettingsCard>
<cwc:SettingsCard Description="{shcm:ResourceString Name=ViewPageLaunchGameAppearanceBorderlessDescription}" Header="-popupwindow"> <cwc:SettingsCard Description="{shcm:ResourceString Name=ViewPageLaunchGameAppearanceBorderlessDescription}" Header="-popupwindow">
<ToggleSwitch Width="120" IsOn="{Binding LaunchOptions.IsBorderless, Mode=TwoWay}"/> <ToggleSwitch MinWidth="{ThemeResource SettingsCardContentControlMinWidth}" IsOn="{Binding LaunchOptions.IsBorderless, Mode=TwoWay}"/>
</cwc:SettingsCard> </cwc:SettingsCard>
<cwc:SettingsCard Description="{shcm:ResourceString Name=ViewPageLaunchGameAppearanceCloudThirdPartyMobileDescription}" Header="-platform_type CLOUD_THIRD_PARTY_MOBILE"> <cwc:SettingsCard Description="{shcm:ResourceString Name=ViewPageLaunchGameAppearanceCloudThirdPartyMobileDescription}" Header="-platform_type CLOUD_THIRD_PARTY_MOBILE">
<ToggleSwitch Width="120" IsOn="{Binding LaunchOptions.IsUseCloudThirdPartyMobile, Mode=TwoWay}"/> <ToggleSwitch MinWidth="{ThemeResource SettingsCardContentControlMinWidth}" IsOn="{Binding LaunchOptions.IsUseCloudThirdPartyMobile, Mode=TwoWay}"/>
</cwc:SettingsCard> </cwc:SettingsCard>
<cwc:SettingsCard Description="{shcm:ResourceString Name=ViewPageLaunchGameAppearanceAspectRatioDescription}" Header="{shcm:ResourceString Name=ViewPageLaunchGameAppearanceAspectRatioHeader}"> <cwc:SettingsCard Description="{shcm:ResourceString Name=ViewPageLaunchGameAppearanceAspectRatioDescription}" Header="{shcm:ResourceString Name=ViewPageLaunchGameAppearanceAspectRatioHeader}">
<shc:SizeRestrictedContentControl Margin="0,0,136,0"> <shc:SizeRestrictedContentControl Margin="0,0,130,0" VerticalAlignment="Center">
<ComboBox <ComboBox
MinWidth="{ThemeResource SettingsCardContentControlMinWidth2}"
ItemsSource="{Binding LaunchOptions.AspectRatios}" ItemsSource="{Binding LaunchOptions.AspectRatios}"
PlaceholderText="{shcm:ResourceString Name=ViewPageLaunchGameAppearanceAspectRatioPlaceHolder}" PlaceholderText="{shcm:ResourceString Name=ViewPageLaunchGameAppearanceAspectRatioPlaceHolder}"
SelectedItem="{Binding LaunchOptions.SelectedAspectRatio, Mode=TwoWay}"/> SelectedItem="{Binding LaunchOptions.SelectedAspectRatio, Mode=TwoWay}"/>
</shc:SizeRestrictedContentControl> </shc:SizeRestrictedContentControl>
</cwc:SettingsCard> </cwc:SettingsCard>
<cwc:SettingsCard Description="{shcm:ResourceString Name=ViewPageLaunchGameAppearanceScreenWidthDescription}" Header="-screen-width"> <cwc:SettingsCard Description="{shcm:ResourceString Name=ViewPageLaunchGameAppearanceScreenWidthDescription}" Header="-screen-width">
<StackPanel Orientation="Horizontal" Spacing="16"> <StackPanel Orientation="Horizontal" Spacing="10">
<NumberBox <NumberBox
Width="156" MinWidth="{ThemeResource SettingsCardContentControlMinWidth2}"
Padding="12,6,0,0" Padding="12,6,0,0"
VerticalAlignment="Center" VerticalAlignment="Center"
IsEnabled="{Binding LaunchOptions.IsScreenWidthEnabled}" IsEnabled="{Binding LaunchOptions.IsScreenWidthEnabled}"
Value="{Binding LaunchOptions.ScreenWidth, Mode=TwoWay}"/> Value="{Binding LaunchOptions.ScreenWidth, Mode=TwoWay}"/>
<ToggleSwitch Width="120" IsOn="{Binding LaunchOptions.IsScreenWidthEnabled, Mode=TwoWay}"/> <ToggleSwitch MinWidth="{ThemeResource SettingsCardContentControlMinWidth}" IsOn="{Binding LaunchOptions.IsScreenWidthEnabled, Mode=TwoWay}"/>
</StackPanel> </StackPanel>
</cwc:SettingsCard> </cwc:SettingsCard>
<cwc:SettingsCard Description="{shcm:ResourceString Name=ViewPageLaunchGameAppearanceScreenHeightDescription}" Header="-screen-height"> <cwc:SettingsCard Description="{shcm:ResourceString Name=ViewPageLaunchGameAppearanceScreenHeightDescription}" Header="-screen-height">
<StackPanel Orientation="Horizontal" Spacing="16"> <StackPanel Orientation="Horizontal" Spacing="10">
<NumberBox <NumberBox
Width="156" MinWidth="{ThemeResource SettingsCardContentControlMinWidth2}"
Padding="12,6,0,0" Padding="12,6,0,0"
VerticalAlignment="Center" VerticalAlignment="Center"
IsEnabled="{Binding LaunchOptions.IsScreenHeightEnabled}" IsEnabled="{Binding LaunchOptions.IsScreenHeightEnabled}"
Value="{Binding LaunchOptions.ScreenHeight, Mode=TwoWay}"/> Value="{Binding LaunchOptions.ScreenHeight, Mode=TwoWay}"/>
<ToggleSwitch Width="120" IsOn="{Binding LaunchOptions.IsScreenHeightEnabled, Mode=TwoWay}"/> <ToggleSwitch MinWidth="{ThemeResource SettingsCardContentControlMinWidth}" IsOn="{Binding LaunchOptions.IsScreenHeightEnabled, Mode=TwoWay}"/>
</StackPanel> </StackPanel>
</cwc:SettingsCard> </cwc:SettingsCard>
<cwc:SettingsCard Description="{shcm:ResourceString Name=ViewPageLaunchGameMonitorsDescription}" Header="-monitor"> <cwc:SettingsCard Description="{shcm:ResourceString Name=ViewPageLaunchGameMonitorsDescription}" Header="-monitor">
<StackPanel Orientation="Horizontal" Spacing="16"> <StackPanel Orientation="Horizontal" Spacing="10">
<shc:SizeRestrictedContentControl> <Button
MinWidth="{ThemeResource SettingsCardContentControlMinWidth}"
Command="{Binding IdentifyMonitorsCommand}"
Content="{shcm:ResourceString Name=ViewModelLaunchGameIdentifyMonitorsAction}"/>
<shc:SizeRestrictedContentControl VerticalAlignment="Center">
<ComboBox <ComboBox
MinWidth="{ThemeResource SettingsCardContentControlMinWidth2}"
DisplayMemberPath="Name" DisplayMemberPath="Name"
IsEnabled="{Binding LaunchOptions.IsMonitorEnabled}" IsEnabled="{Binding LaunchOptions.IsMonitorEnabled}"
ItemsSource="{Binding LaunchOptions.Monitors}" ItemsSource="{Binding LaunchOptions.Monitors}"
SelectedItem="{Binding LaunchOptions.Monitor, Mode=TwoWay}"/> SelectedItem="{Binding LaunchOptions.Monitor, Mode=TwoWay}"/>
</shc:SizeRestrictedContentControl> </shc:SizeRestrictedContentControl>
<ToggleSwitch Width="120" IsOn="{Binding LaunchOptions.IsMonitorEnabled, Mode=TwoWay}"/> <ToggleSwitch MinWidth="{ThemeResource SettingsCardContentControlMinWidth}" IsOn="{Binding LaunchOptions.IsMonitorEnabled, Mode=TwoWay}"/>
</StackPanel> </StackPanel>
</cwc:SettingsCard> </cwc:SettingsCard>
</cwc:SettingsExpander.Items> </cwc:SettingsExpander.Items>
</cwc:SettingsExpander> </cwc:SettingsExpander>
<cwc:SettingsCard <cwc:SettingsCard
Padding="{ThemeResource SettingsCardAlignSettingsExpanderPadding}"
Description="{shcm:ResourceString Name=ViewPageLaunchGameUnlockFpsDescription}" Description="{shcm:ResourceString Name=ViewPageLaunchGameUnlockFpsDescription}"
Header="{shcm:ResourceString Name=ViewPageLaunchGameUnlockFpsHeader}" Header="{shcm:ResourceString Name=ViewPageLaunchGameUnlockFpsHeader}"
HeaderIcon="{shcm:FontIcon Glyph=&#xE785;}" HeaderIcon="{shcm:FontIcon Glyph=&#xE785;}"
IsEnabled="{Binding RuntimeOptions.IsElevated}" IsEnabled="{Binding RuntimeOptions.IsElevated}"
Visibility="{Binding LaunchOptions.IsAdvancedLaunchOptionsEnabled, Converter={StaticResource BoolToVisibilityConverter}}"> Visibility="{Binding LaunchOptions.IsAdvancedLaunchOptionsEnabled, Converter={StaticResource BoolToVisibilityConverter}}">
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal" Spacing="10">
<shvc:Elevation Margin="0,0,36,0" Visibility="{Binding RuntimeOptions.IsElevated, Converter={StaticResource BoolToVisibilityRevertConverter}}"/> <shvc:Elevation Visibility="{Binding RuntimeOptions.IsElevated, Converter={StaticResource BoolToVisibilityRevertConverter}}"/>
<NumberBox <NumberBox
MinWidth="156" MinWidth="{ThemeResource SettingsCardContentControlMinWidth2}"
Padding="10,8,0,0" Padding="10,8,0,0"
Maximum="720" Maximum="720"
Minimum="60" Minimum="60"
SpinButtonPlacementMode="Inline" SpinButtonPlacementMode="Inline"
Value="{Binding LaunchOptions.TargetFps, Mode=TwoWay}"/> Value="{Binding LaunchOptions.TargetFps, Mode=TwoWay}"/>
<ToggleSwitch <ToggleSwitch
Width="120" MinWidth="{ThemeResource SettingsCardContentControlMinWidth}"
IsOn="{Binding LaunchOptions.UnlockFps, Mode=TwoWay}" IsOn="{Binding LaunchOptions.UnlockFps, Mode=TwoWay}"
OffContent="{shcm:ResourceString Name=ViewPageLaunchGameUnlockFpsOff}" OffContent="{shcm:ResourceString Name=ViewPageLaunchGameUnlockFpsOff}"
OnContent="{shcm:ResourceString Name=ViewPageLaunchGameUnlockFpsOn}"/> OnContent="{shcm:ResourceString Name=ViewPageLaunchGameUnlockFpsOn}"/>
@@ -300,13 +307,13 @@
Description="{shcm:ResourceString Name=ViewPageLaunchGamePlayTimeDescription}" Description="{shcm:ResourceString Name=ViewPageLaunchGamePlayTimeDescription}"
Header="{shcm:ResourceString Name=ViewPageLaunchGamePlayTimeHeader}" Header="{shcm:ResourceString Name=ViewPageLaunchGamePlayTimeHeader}"
HeaderIcon="{shcm:FontIcon Glyph=&#xEC92;}"> HeaderIcon="{shcm:FontIcon Glyph=&#xEC92;}">
<ToggleSwitch Width="120" IsOn="{Binding LaunchOptions.UseStarwardPlayTimeStatistics, Mode=TwoWay}"/> <ToggleSwitch MinWidth="{ThemeResource SettingsCardContentControlMinWidth}" IsOn="{Binding LaunchOptions.UseStarwardPlayTimeStatistics, Mode=TwoWay}"/>
</cwc:SettingsCard> </cwc:SettingsCard>
<cwc:SettingsCard <cwc:SettingsCard
Description="{shcm:ResourceString Name=ViewPageLaunchGameDiscordActivityDescription}" Description="{shcm:ResourceString Name=ViewPageLaunchGameDiscordActivityDescription}"
Header="{shcm:ResourceString Name=ViewPageLaunchGameDiscordActivityHeader}" Header="{shcm:ResourceString Name=ViewPageLaunchGameDiscordActivityHeader}"
HeaderIcon="{shcm:FontIcon Glyph=&#xE8CF;}"> HeaderIcon="{shcm:FontIcon Glyph=&#xE8CF;}">
<ToggleSwitch Width="120" IsOn="{Binding LaunchOptions.SetDiscordActivityWhenPlaying, Mode=TwoWay}"/> <ToggleSwitch MinWidth="{ThemeResource SettingsCardContentControlMinWidth}" IsOn="{Binding LaunchOptions.SetDiscordActivityWhenPlaying, Mode=TwoWay}"/>
</cwc:SettingsCard> </cwc:SettingsCard>
</StackPanel> </StackPanel>
</Grid> </Grid>
@@ -355,8 +362,8 @@
VerticalAlignment="Center" VerticalAlignment="Center"
Spacing="3"> Spacing="3">
<shci:CachedImage <shci:CachedImage
Width="120"
Height="120" Height="120"
MinWidth="{ThemeResource SettingsCardContentControlMinWidth}"
EnableLazyLoading="False" EnableLazyLoading="False"
Source="{StaticResource UI_EmotionIcon445}"/> Source="{StaticResource UI_EmotionIcon445}"/>
<TextBlock <TextBlock

View File

@@ -3,6 +3,7 @@
using CommunityToolkit.WinUI.Collections; using CommunityToolkit.WinUI.Collections;
using Microsoft.Extensions.Caching.Memory; using Microsoft.Extensions.Caching.Memory;
using Microsoft.UI.Windowing;
using Snap.Hutao.Core; using Snap.Hutao.Core;
using Snap.Hutao.Core.Diagnostics.CodeAnalysis; using Snap.Hutao.Core.Diagnostics.CodeAnalysis;
using Snap.Hutao.Core.ExceptionService; using Snap.Hutao.Core.ExceptionService;
@@ -338,4 +339,28 @@ internal sealed partial class LaunchGameViewModel : Abstraction.ViewModel, IView
}; };
} }
} }
[Command("IdentifyMonitorsCommand")]
private async Task IdentifyMonitorsAsync()
{
List<IdentifyMonitorWindow> windows = [];
IReadOnlyList<DisplayArea> displayAreas = DisplayArea.FindAll();
for (int i = 0; i < displayAreas.Count; i++)
{
windows.Add(new IdentifyMonitorWindow(displayAreas[i], i + 1));
}
foreach (IdentifyMonitorWindow window in windows)
{
window.Activate();
}
await Delay.FromSeconds(3).ConfigureAwait(true);
foreach (IdentifyMonitorWindow window in windows)
{
window.Close();
}
}
} }