mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-18 10:10:45 +08:00
perf: 移除SettingsViewModel不必要的绑定
This commit is contained in:
@@ -14,15 +14,12 @@
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Media.Imaging;
|
||||
using MaaWpfGui.Constants;
|
||||
using MaaWpfGui.Helper;
|
||||
@@ -43,9 +40,9 @@ namespace MaaWpfGui.Services.RemoteControl
|
||||
public class RemoteControlService
|
||||
{
|
||||
private Task _pollJobTask = Task.CompletedTask;
|
||||
private readonly List<string> _enqueueTaskIds = new List<string>();
|
||||
private readonly ConcurrentQueue<JObject> _sequentialTaskQueue = new ConcurrentQueue<JObject>();
|
||||
private readonly ConcurrentQueue<JObject> _instantTaskQueue = new ConcurrentQueue<JObject>();
|
||||
private readonly List<string> _enqueueTaskIds = [];
|
||||
private readonly ConcurrentQueue<JObject> _sequentialTaskQueue = new();
|
||||
private readonly ConcurrentQueue<JObject> _instantTaskQueue = new();
|
||||
private Task _executeSequentialJobTask = Task.CompletedTask;
|
||||
private Task _executeInstantJobTask = Task.CompletedTask;
|
||||
private readonly RunningState _runningState;
|
||||
|
||||
@@ -385,20 +385,6 @@ namespace MaaWpfGui.ViewModels.UI
|
||||
|
||||
#region Remote Control
|
||||
|
||||
// UI 绑定的方法
|
||||
// ReSharper disable once UnusedMember.Global
|
||||
public async void RemoteControlConnectionTest()
|
||||
{
|
||||
await RemoteControlService.ConnectionTest();
|
||||
}
|
||||
|
||||
// UI 绑定的方法
|
||||
// ReSharper disable once UnusedMember.Global
|
||||
public void RemoteControlRegenerateDeviceIdentity()
|
||||
{
|
||||
RemoteControlService.RegenerateDeviceIdentity();
|
||||
}
|
||||
|
||||
private string _remoteControlGetTaskEndpointUri = ConfigurationHelper.GetValue(ConfigurationKeys.RemoteControlGetTaskEndpointUri, string.Empty);
|
||||
|
||||
public string RemoteControlGetTaskEndpointUri
|
||||
|
||||
@@ -2,31 +2,33 @@
|
||||
x:Class="MaaWpfGui.Views.UserControl.RemoteControlUserControl"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:ui="clr-namespace:MaaWpfGui.ViewModels.UI"
|
||||
xmlns:controls="clr-namespace:MaaWpfGui.Styles.Controls"
|
||||
xmlns:calcBinding="clr-namespace:CalcBinding;assembly=CalcBinding"
|
||||
xmlns:s="https://github.com/canton7/Stylet"
|
||||
xmlns:calcBinding="clr-namespace:CalcBinding;assembly=CalcBinding"
|
||||
xmlns:constants="clr-namespace:MaaWpfGui.Constants"
|
||||
xmlns:controls="clr-namespace:MaaWpfGui.Styles.Controls"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:remoteControl="clr-namespace:MaaWpfGui.Services.RemoteControl"
|
||||
xmlns:s="https://github.com/canton7/Stylet"
|
||||
xmlns:ui="clr-namespace:MaaWpfGui.ViewModels.UI"
|
||||
d:Background="White"
|
||||
d:DataContext="{d:DesignInstance {x:Type ui:SettingsViewModel}}"
|
||||
d:DesignHeight="300"
|
||||
d:DesignWidth="550"
|
||||
mc:Ignorable="d">
|
||||
<Grid Margin="10">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<controls:TextBlock
|
||||
Grid.Row="0"
|
||||
@@ -37,7 +39,7 @@
|
||||
Block.TextAlignment="Center"
|
||||
Text="{DynamicResource RemoteControlTooltips}"
|
||||
TextWrapping="Wrap" />
|
||||
<!-- Control Endpoint Input -->
|
||||
<!-- Control Endpoint Input -->
|
||||
<controls:TextBlock
|
||||
Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
@@ -45,13 +47,14 @@
|
||||
Block.TextAlignment="Center"
|
||||
Text="{DynamicResource RemoteControlGetTaskEndpointLabel}"
|
||||
TextWrapping="Wrap" />
|
||||
<TextBox
|
||||
<TextBox
|
||||
Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
Margin="0,5,0,5"
|
||||
Text="{Binding RemoteControlGetTaskEndpointUri}" Grid.ColumnSpan="2"/>
|
||||
Grid.ColumnSpan="2"
|
||||
Margin="0,5,0,5"
|
||||
Text="{Binding RemoteControlGetTaskEndpointUri}" />
|
||||
|
||||
<!-- Handshake Endpoint Input -->
|
||||
<!-- Handshake Endpoint Input -->
|
||||
<controls:TextBlock
|
||||
Grid.Row="2"
|
||||
Grid.Column="0"
|
||||
@@ -59,13 +62,14 @@
|
||||
Block.TextAlignment="Center"
|
||||
Text="{DynamicResource RemoteControlReportStatusEndpointLabel}"
|
||||
TextWrapping="Wrap" />
|
||||
<TextBox
|
||||
<TextBox
|
||||
Grid.Row="2"
|
||||
Grid.Column="1"
|
||||
Margin="0,5,0,5"
|
||||
Text="{Binding RemoteControlReportStatusUri}" Grid.ColumnSpan="2"/>
|
||||
Grid.ColumnSpan="2"
|
||||
Margin="0,5,0,5"
|
||||
Text="{Binding RemoteControlReportStatusUri}" />
|
||||
|
||||
<!-- User Identity Input -->
|
||||
<!-- User Identity Input -->
|
||||
<controls:TextBlock
|
||||
Grid.Row="3"
|
||||
Grid.Column="0"
|
||||
@@ -73,19 +77,20 @@
|
||||
Block.TextAlignment="Center"
|
||||
Text="{DynamicResource RemoteControlUserIdentityLabel}"
|
||||
TextWrapping="Wrap" />
|
||||
<TextBox
|
||||
<TextBox
|
||||
Grid.Row="3"
|
||||
Grid.Column="1"
|
||||
Margin="0,5,0,5"
|
||||
Text="{Binding RemoteControlUserIdentity}"/>
|
||||
Margin="0,5,0,5"
|
||||
Text="{Binding RemoteControlUserIdentity}" />
|
||||
<Button
|
||||
Grid.Row="3"
|
||||
Grid.Column="2"
|
||||
Margin="5"
|
||||
Command="{s:Action RemoteControlConnectionTest}"
|
||||
Content="{DynamicResource RemoteControlConnectionTest}"/>
|
||||
Command="{s:Action ConnectionTest,
|
||||
Target={x:Type remoteControl:RemoteControlService}}"
|
||||
Content="{DynamicResource RemoteControlConnectionTest}" />
|
||||
|
||||
<!-- Remote ID (Read-only & Copyable) -->
|
||||
<!-- Remote ID (Read-only & Copyable) -->
|
||||
<controls:TextBlock
|
||||
Grid.Row="4"
|
||||
Grid.Column="0"
|
||||
@@ -93,31 +98,36 @@
|
||||
Block.TextAlignment="Center"
|
||||
Text="{DynamicResource RemoteControlDeviceIdentityLabel}"
|
||||
TextWrapping="Wrap" />
|
||||
<TextBox
|
||||
<TextBox
|
||||
Grid.Row="4"
|
||||
Grid.Column="1"
|
||||
Margin="0,5,0,5"
|
||||
Text="{Binding RemoteControlDeviceIdentity}"
|
||||
IsReadOnly="True"
|
||||
ContextMenuService.IsEnabled="False"/>
|
||||
Margin="0,5,0,5"
|
||||
ContextMenuService.IsEnabled="False"
|
||||
IsReadOnly="True"
|
||||
Text="{Binding RemoteControlDeviceIdentity}" />
|
||||
<Button
|
||||
Grid.Row="4"
|
||||
Grid.Column="2"
|
||||
Margin="5"
|
||||
Command="{s:Action RemoteControlRegenerateDeviceIdentity}"
|
||||
Content="{DynamicResource RemoteControlRegenerateDeviceIdentity}"/>
|
||||
Command="{s:Action RegenerateDeviceIdentity,
|
||||
Target={x:Type remoteControl:RemoteControlService}}"
|
||||
Content="{DynamicResource RemoteControlRegenerateDeviceIdentity}" />
|
||||
|
||||
<StackPanel HorizontalAlignment="Center" Grid.Row="5" Grid.Column="0" Grid.ColumnSpan="3">
|
||||
<StackPanel
|
||||
Grid.Row="5"
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="3"
|
||||
HorizontalAlignment="Center">
|
||||
<controls:TextBlock
|
||||
FontSize="11"
|
||||
Margin="10"
|
||||
Block.TextAlignment="Center"
|
||||
FontSize="11"
|
||||
Text="{DynamicResource RemoteControlDeveloperTooltips}"
|
||||
TextWrapping="Wrap" />
|
||||
<controls:TextBlock
|
||||
FontSize="11"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center">
|
||||
VerticalAlignment="Center"
|
||||
FontSize="11">
|
||||
<Hyperlink
|
||||
Cursor="Hand"
|
||||
NavigateUri="{Binding Source={x:Static constants:MaaUrls.RemoteControlDocument}}"
|
||||
|
||||
Reference in New Issue
Block a user