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}" /> - + + + +