Files
MaaAssistantArknights/src/MaaWpfGui/Views/UserControl/Settings/ConnectSettingsUserControl.xaml
2025-07-28 17:28:46 +08:00

291 lines
13 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<UserControl
x:Class="MaaWpfGui.Views.UserControl.Settings.ConnectSettingsUserControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:c="clr-namespace:CalcBinding;assembly=CalcBinding"
xmlns:controls="clr-namespace:MaaWpfGui.Styles.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:dd="urn:gong-wpf-dragdrop"
xmlns:hc="https://handyorg.github.io/handycontrol"
xmlns:helper="clr-namespace:MaaWpfGui.Helper"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:s="https://github.com/canton7/Stylet"
xmlns:viewModels="clr-namespace:MaaWpfGui.ViewModels.UserControl.Settings"
d:Background="White"
d:DataContext="{d:DesignInstance {x:Type viewModels:ConnectSettingsUserControlModel}}"
d:DesignWidth="550"
s:View.ActionTarget="{Binding}"
mc:Ignorable="d">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<StackPanel
Grid.Row="0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Orientation="Horizontal">
<StackPanel Orientation="Horizontal">
<CheckBox
Margin="10,10,0,10"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Content="{DynamicResource AutoDetectConnection}"
IsChecked="{Binding AutoDetectConnection}" />
<controls:TooltipBlock TooltipText="{DynamicResource AutoDetectConnectionTip}" />
</StackPanel>
<CheckBox
Margin="10"
VerticalAlignment="Center"
Content="{DynamicResource AlwaysAutoDetectConnection}"
IsChecked="{Binding AlwaysAutoDetectConnection}"
Visibility="{c:Binding AutoDetectConnection}" />
</StackPanel>
<StackPanel
Grid.Row="1"
HorizontalAlignment="Center"
IsEnabled="{c:Binding !AutoDetectConnection}"
Orientation="Horizontal">
<hc:TextBox
Width="420"
Height="30"
Margin="10"
hc:TitleElement.Title="{DynamicResource AdbPath}"
hc:TitleElement.TitlePlacement="Left"
Text="{Binding AdbPath}" />
<Button
Width="60"
Height="30"
Margin="10"
HorizontalAlignment="Right"
Command="{s:Action SelectFile}"
Content="{DynamicResource Select}" />
</StackPanel>
<StackPanel
Grid.Row="2"
HorizontalAlignment="Center"
Orientation="Horizontal">
<!-- 对称居中 -->
<controls:TooltipBlock Visibility="Hidden" />
<hc:ComboBox
Width="300"
Height="30"
Margin="10"
HorizontalContentAlignment="Stretch"
hc:TitleElement.Title="{DynamicResource ConnectionAddress}"
hc:TitleElement.TitlePlacement="Left"
IsEditable="True"
IsEnabled="{c:Binding !AutoDetectConnection}"
ItemsSource="{Binding ConnectAddressHistory}"
Text="{Binding ConnectAddress, UpdateSourceTrigger=LostFocus}">
<ComboBox.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock
Grid.Column="0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Text="{Binding}" />
<Button
Grid.Column="1"
Width="30"
Height="30"
HorizontalAlignment="Right"
Command="{s:Action RemoveAddressClick}"
CommandParameter="{Binding}"
Content="×"
FontWeight="Bold" />
</Grid>
</DataTemplate>
</ComboBox.ItemTemplate>
</hc:ComboBox>
<controls:TooltipBlock TooltipText="{DynamicResource ConnectionAddressTip}" />
</StackPanel>
<StackPanel Grid.Row="3" IsEnabled="{c:Binding !AutoDetectConnection}">
<hc:ComboBox
Width="300"
Height="30"
Margin="10"
hc:TitleElement.Title="{DynamicResource ConnectionPreset}"
hc:TitleElement.TitlePlacement="Left"
DisplayMemberPath="Display"
ItemsSource="{Binding ConnectConfigList}"
SelectedValue="{Binding ConnectConfig}"
SelectedValuePath="Value" />
<StackPanel>
<StackPanel Visibility="{c:Binding 'ConnectConfig==&quot;MuMuEmulator12&quot;'}">
<CheckBox
Margin="10"
HorizontalAlignment="Center"
Content="{DynamicResource MuMu12ExtrasEnabled}"
IsChecked="{Binding MuMuEmulator12Extras.Enable}" />
<StackPanel
HorizontalAlignment="Center"
Orientation="Vertical"
Visibility="{c:Binding MuMuEmulator12Extras.Enable}">
<hc:TextBox
Width="420"
Height="30"
Margin="10"
hc:InfoElement.Placeholder="Example: C:\Program Files\Netease\MuMuPlayer-12.0"
hc:TitleElement.Title="{DynamicResource MuMu12EmulatorPath}"
hc:TitleElement.TitlePlacement="Left"
Text="{Binding MuMuEmulator12Extras.EmulatorPath}" />
<StackPanel HorizontalAlignment="Center" Orientation="Vertical">
<CheckBox
Margin="10"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Content="{DynamicResource MuMuBridgeConnection}"
IsChecked="{Binding MuMuEmulator12Extras.MuMuBridgeConnection}" />
<hc:TextBox
Height="30"
Margin="10"
HorizontalContentAlignment="Center"
hc:TitleElement.Title="{DynamicResource MuMu12Index}"
hc:TitleElement.TitlePlacement="Left"
Text="{Binding MuMuEmulator12Extras.Index}"
Visibility="{c:Binding MuMuEmulator12Extras.MuMuBridgeConnection}" />
</StackPanel>
</StackPanel>
</StackPanel>
<StackPanel Visibility="{c:Binding 'ConnectConfig==&quot;LDPlayer&quot;'}">
<CheckBox
Margin="10"
HorizontalAlignment="Center"
Content="{DynamicResource LdExtrasEnabled}"
IsChecked="{Binding LdPlayerExtras.Enable}" />
<StackPanel Visibility="{c:Binding LdPlayerExtras.Enable}">
<hc:TextBox
Width="420"
Height="30"
Margin="10"
hc:InfoElement.Placeholder="Example: C:\leidian\LDPlayer9"
hc:TitleElement.Title="{DynamicResource LdEmulatorPath}"
hc:TitleElement.TitlePlacement="Left"
Text="{Binding LdPlayerExtras.EmulatorPath}" />
<StackPanel>
<CheckBox
HorizontalAlignment="Center"
VerticalContentAlignment="Center"
Content="{DynamicResource LdManualSetIndex}"
IsChecked="{Binding LdPlayerExtras.ManualSetIndex}" />
<hc:TextBox
Width="130"
Height="30"
Margin="10"
hc:InfoElement.Placeholder="0"
hc:TitleElement.Title="{DynamicResource LdIndex}"
hc:TitleElement.TitlePlacement="Left"
Text="{Binding LdPlayerExtras.Index}"
Visibility="{c:Binding LdPlayerExtras.ManualSetIndex}" />
</StackPanel>
</StackPanel>
</StackPanel>
</StackPanel>
</StackPanel>
<StackPanel
Grid.Row="4"
HorizontalAlignment="Center"
Orientation="Vertical">
<Button
Height="30"
Margin="5"
HorizontalAlignment="Center"
Command="{s:Action TestLinkAndGetImage}"
Content="{DynamicResource ScreenshotTest}" />
<controls:TextBlock
Margin="5"
HorizontalAlignment="Center"
Text="{Binding TestLinkInfo}"
Visibility="{c:Binding 'TestLinkInfo!=&quot;&quot;'}" />
</StackPanel>
<controls:TextBlock
Grid.Row="5"
Margin="10"
HorizontalAlignment="Center"
Text="{c:Binding ScreencapCost}" />
<StackPanel Grid.Row="6" HorizontalAlignment="Center">
<StackPanel Orientation="Horizontal">
<CheckBox
Margin="20,10,0,10"
Content="{DynamicResource RetryOnDisconnected}"
IsChecked="{Binding RetryOnDisconnected}" />
<controls:TooltipBlock TooltipText="{DynamicResource RetryOnDisconnectedTip}" />
</StackPanel>
<CheckBox
Margin="20,10"
Content="{DynamicResource AllowAdbRestart}"
IsChecked="{Binding AllowAdbRestart}" />
<CheckBox
Margin="20,10"
Content="{DynamicResource AllowAdbHardRestart}"
IsChecked="{Binding AllowAdbHardRestart}" />
</StackPanel>
<StackPanel
Grid.Row="7"
HorizontalAlignment="Center"
Orientation="Horizontal">
<hc:ComboBox
Height="30"
Margin="10"
hc:TitleElement.Title="{DynamicResource TouchMode}"
hc:TitleElement.TitlePlacement="Left"
DisplayMemberPath="Display"
IsHitTestVisible="{Binding Idle, Source={x:Static helper:Instances.SettingsViewModel}}"
ItemsSource="{Binding TouchModeList}"
SelectedValue="{Binding TouchMode}"
SelectedValuePath="Value" />
<Button
Height="30"
Margin="10"
HorizontalAlignment="Left"
Command="{s:Action ReplaceAdb}"
Content="{DynamicResource ForcedReplaceAdb}" />
</StackPanel>
<StackPanel Grid.Row="8">
<StackPanel HorizontalAlignment="Center" Orientation="Horizontal">
<CheckBox
Margin="20,10"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Content="{DynamicResource KillAdbOnExit}"
IsChecked="{Binding KillAdbOnExit}" />
<CheckBox
Margin="20,10"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Content="{DynamicResource AdbLiteEnabled}"
IsChecked="{Binding AdbLiteEnabled}" />
</StackPanel>
</StackPanel>
<StackPanel
Grid.Row="9"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Orientation="Horizontal" />
</Grid>
</UserControl>