From e1b58dd884fd31bd13dc24caaedba0b7086269d3 Mon Sep 17 00:00:00 2001
From: uye <99072975+ABA2396@users.noreply.github.com>
Date: Fri, 6 Jun 2025 13:44:53 +0800
Subject: [PATCH] =?UTF-8?q?feat:=20=E8=BF=9C=E7=A8=8B=E6=8E=A7=E5=88=B6?=
=?UTF-8?q?=E5=8D=8F=E8=AE=AE=E5=A2=9E=E5=8A=A0=E2=80=9C=E8=BD=AE=E8=AF=A2?=
=?UTF-8?q?=E9=97=B4=E9=9A=94=E2=80=9D=E5=8F=82=E6=95=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
fix #12904
---
src/MaaWpfGui/Constants/ConfigurationKeys.cs | 1 +
src/MaaWpfGui/Res/Localizations/en-us.xaml | 1 +
src/MaaWpfGui/Res/Localizations/ja-jp.xaml | 1 +
src/MaaWpfGui/Res/Localizations/ko-kr.xaml | 1 +
src/MaaWpfGui/Res/Localizations/zh-cn.xaml | 1 +
src/MaaWpfGui/Res/Localizations/zh-tw.xaml | 1 +
.../RemoteControl/RemoteControlService.cs | 6 ++--
.../Settings/RemoteControlUserControlModel.cs | 17 +++++++++++
.../Settings/RemoteControlUserControl.xaml | 29 ++++++++++++++-----
9 files changed, 48 insertions(+), 10 deletions(-)
diff --git a/src/MaaWpfGui/Constants/ConfigurationKeys.cs b/src/MaaWpfGui/Constants/ConfigurationKeys.cs
index 5c3071965a..195fd5be1b 100644
--- a/src/MaaWpfGui/Constants/ConfigurationKeys.cs
+++ b/src/MaaWpfGui/Constants/ConfigurationKeys.cs
@@ -258,6 +258,7 @@ namespace MaaWpfGui.Constants
public const string RemoteControlReportStatusUri = "RemoteControl.RemoteControlReportStatusUri";
public const string RemoteControlUserIdentity = "RemoteControl.RemoteControlUserIdentity";
public const string RemoteControlDeviceIdentity = "RemoteControl.RemoteControlDeviceIdentity";
+ public const string RemoteControlPollIntervalMs = "RemoteControl.RemoteControlPollIntervalMs";
public const string ExternalNotificationEnabled = "ExternalNotification.Enabled";
public const string ExternalNotificationSendWhenComplete = "ExternalNotification.SendWhenComplete";
diff --git a/src/MaaWpfGui/Res/Localizations/en-us.xaml b/src/MaaWpfGui/Res/Localizations/en-us.xaml
index 62725cecd8..1c38749258 100644
--- a/src/MaaWpfGui/Res/Localizations/en-us.xaml
+++ b/src/MaaWpfGui/Res/Localizations/en-us.xaml
@@ -1005,6 +1005,7 @@ Please switch to the stage selection page before starting
User Identifier
Get Task Endpoint
Report Task Endpoint
+ Polling Interval (ms)
Connection Test Successful!
Connection Test Failed, reason: {0}.
Connection Test Failed, Endpoint is empty.
diff --git a/src/MaaWpfGui/Res/Localizations/ja-jp.xaml b/src/MaaWpfGui/Res/Localizations/ja-jp.xaml
index d942423eed..bfc11b86e4 100644
--- a/src/MaaWpfGui/Res/Localizations/ja-jp.xaml
+++ b/src/MaaWpfGui/Res/Localizations/ja-jp.xaml
@@ -1009,6 +1009,7 @@ C:\\leidian\\LDPlayer9
ユーザー識別子
タスクエンドポイントの取得
タスクステータスの報告エンドポイント
+ ポーリング間隔 (ms)
接続テスト成功!
接続テスト失敗、理由: {0}。
接続テスト失敗、エンドポイントが空です。
diff --git a/src/MaaWpfGui/Res/Localizations/ko-kr.xaml b/src/MaaWpfGui/Res/Localizations/ko-kr.xaml
index fa236e7b74..3f2bea1a2e 100644
--- a/src/MaaWpfGui/Res/Localizations/ko-kr.xaml
+++ b/src/MaaWpfGui/Res/Localizations/ko-kr.xaml
@@ -1008,6 +1008,7 @@ C:\\leidian\\LDPlayer9
사용자 식별자
작업 엔드포인트 가져오기
작업 상태 보고 엔드포인트
+ 폴링 간격 (ms)
연결 테스트 성공!
연결 테스트 실패, 원인: {0}.
연결 테스트 실패, 엔드포인트가 비어 있습니다.
diff --git a/src/MaaWpfGui/Res/Localizations/zh-cn.xaml b/src/MaaWpfGui/Res/Localizations/zh-cn.xaml
index babbfc7fe9..e8ba45dedb 100644
--- a/src/MaaWpfGui/Res/Localizations/zh-cn.xaml
+++ b/src/MaaWpfGui/Res/Localizations/zh-cn.xaml
@@ -1009,6 +1009,7 @@ C:\\leidian\\LDPlayer9。\n
用户标识符
获取任务端点
汇报任务端点
+ 轮询间隔 (ms)
连接测试成功!
连接测试失败,原因: {0}。
连接测试失败,连接端点为空。
diff --git a/src/MaaWpfGui/Res/Localizations/zh-tw.xaml b/src/MaaWpfGui/Res/Localizations/zh-tw.xaml
index f2ec0d38a0..b6875d920c 100644
--- a/src/MaaWpfGui/Res/Localizations/zh-tw.xaml
+++ b/src/MaaWpfGui/Res/Localizations/zh-tw.xaml
@@ -1007,6 +1007,7 @@ C:\\leidian\\LDPlayer9。\n
使用者標識符
獲取任務端點
匯報任務端點
+ 輪詢間隔 (ms)
連接測試成功!
連接測試失敗,原因: {0}。
連接測試失敗,連接端點為空。
diff --git a/src/MaaWpfGui/Services/RemoteControl/RemoteControlService.cs b/src/MaaWpfGui/Services/RemoteControl/RemoteControlService.cs
index da91aea3f8..9669ff2093 100644
--- a/src/MaaWpfGui/Services/RemoteControl/RemoteControlService.cs
+++ b/src/MaaWpfGui/Services/RemoteControl/RemoteControlService.cs
@@ -80,7 +80,7 @@ namespace MaaWpfGui.Services.RemoteControl
{
while (true)
{
- await Task.Delay(1000);
+ await Task.Delay(RemoteSettings.RemoteControlPollIntervalMs);
try
{
if (!IsEndpointValid(RemoteSettings.RemoteControlGetTaskEndpointUri))
@@ -105,7 +105,7 @@ namespace MaaWpfGui.Services.RemoteControl
{
while (true)
{
- await Task.Delay(1000);
+ await Task.Delay(RemoteSettings.RemoteControlPollIntervalMs);
try
{
if (!IsEndpointValid(RemoteSettings.RemoteControlGetTaskEndpointUri))
@@ -129,7 +129,7 @@ namespace MaaWpfGui.Services.RemoteControl
{
while (true)
{
- await Task.Delay(1000);
+ await Task.Delay(RemoteSettings.RemoteControlPollIntervalMs);
try
{
if (!IsEndpointValid(RemoteSettings.RemoteControlGetTaskEndpointUri))
diff --git a/src/MaaWpfGui/ViewModels/UserControl/Settings/RemoteControlUserControlModel.cs b/src/MaaWpfGui/ViewModels/UserControl/Settings/RemoteControlUserControlModel.cs
index b2baebe99f..91c414c21e 100644
--- a/src/MaaWpfGui/ViewModels/UserControl/Settings/RemoteControlUserControlModel.cs
+++ b/src/MaaWpfGui/ViewModels/UserControl/Settings/RemoteControlUserControlModel.cs
@@ -12,6 +12,7 @@
//
#nullable enable
+using System;
using MaaWpfGui.Constants;
using MaaWpfGui.Helper;
using Stylet;
@@ -86,4 +87,20 @@ public class RemoteControlUserControlModel : PropertyChangedBase
ConfigurationHelper.SetValue(ConfigurationKeys.RemoteControlDeviceIdentity, value);
}
}
+
+ private int _remoteControlPollIntervalMs = Convert.ToInt32(ConfigurationHelper.GetValue(ConfigurationKeys.RemoteControlPollIntervalMs, "1000"));
+
+ public int RemoteControlPollIntervalMs
+ {
+ get => _remoteControlPollIntervalMs;
+ set
+ {
+ if (!SetAndNotify(ref _remoteControlPollIntervalMs, value))
+ {
+ return;
+ }
+
+ ConfigurationHelper.SetValue(ConfigurationKeys.RemoteControlPollIntervalMs, value.ToString());
+ }
+ }
}
diff --git a/src/MaaWpfGui/Views/UserControl/Settings/RemoteControlUserControl.xaml b/src/MaaWpfGui/Views/UserControl/Settings/RemoteControlUserControl.xaml
index c29ceb97b3..8776298f47 100644
--- a/src/MaaWpfGui/Views/UserControl/Settings/RemoteControlUserControl.xaml
+++ b/src/MaaWpfGui/Views/UserControl/Settings/RemoteControlUserControl.xaml
@@ -24,6 +24,7 @@
+
@@ -69,21 +70,35 @@
Margin="0,5,0,5"
Text="{Binding RemoteControlReportStatusUri}" />
-
+
+
+
+