feat. 增加始终自动检测连接选项

This commit is contained in:
lhhxxxxx
2022-11-10 22:10:48 +08:00
parent 4c839ba817
commit 05dc0147c1
4 changed files with 39 additions and 11 deletions

View File

@@ -1064,7 +1064,10 @@ namespace MeoAsstGui
if (ret)
{
settings.AutoDetectConnection = false;
if (!settings.AlwaysAutoDetectConnection)
{
settings.AutoDetectConnection = false;
}
}
else
{

View File

@@ -206,7 +206,8 @@
<system:String x:Key="CustomStageCodeTip">测试功能支持大部分主线关卡名与原列表的关卡名如4-10、AP-5</system:String>
<system:String x:Key="AutoDetectConnection">自动检测连接</system:String>
<system:String x:Key="AutoDetectConnectionTip">每次检测完成后会自动取消勾选,若需要重新检测可再次勾选</system:String>
<system:String x:Key="AutoDetectConnectionTip">每次检测完成后会自动取消勾选,若需要重新检测可再次勾选,若反复连接失败可勾选始终自动检测连接</system:String>
<system:String x:Key="AlwaysAutoDetectConnection">始终自动检测连接</system:String>
<system:String x:Key="ADBPath">adb 路径 (相对/绝对)</system:String>
<system:String x:Key="ConnectionAddress">连接地址</system:String>
<system:String x:Key="ConnectionAddressTip">若遇到问题可尝试手动修改</system:String>

View File

@@ -24,6 +24,7 @@
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<CheckBox
Grid.Row="0"
@@ -34,16 +35,26 @@
Content="{DynamicResource AutoDetectConnection}"
ToolTip="{DynamicResource AutoDetectConnectionTip}"
HorizontalAlignment="Center" />
<TextBlock
<CheckBox
Grid.Row="1"
Grid.Column="0"
Grid.ColumnSpan="2"
Margin="15"
VerticalAlignment="Center"
IsChecked="{Binding AlwaysAutoDetectConnection}"
Content="{DynamicResource AlwaysAutoDetectConnection}"
Visibility="{c:Binding AutoDetectConnection}"
HorizontalAlignment="Center" />
<TextBlock
Grid.Row="2"
Grid.Column="0"
Margin="10"
Block.TextAlignment="Center"
Style="{StaticResource TextBlockDefault}"
Text="{DynamicResource ADBPath}"
TextWrapping="Wrap" />
<TextBox
Grid.Row="1"
Grid.Row="2"
Grid.Column="1"
Width="250"
Height="30"
@@ -51,8 +62,8 @@
IsEnabled="{c:Binding !AutoDetectConnection}"
Text="{Binding AdbPath}" />
<Button
Grid.Row="1"
Grid.Column="3"
Grid.Row="2"
Grid.Column="2"
Width="60"
Height="30"
Margin="10"
@@ -62,7 +73,7 @@
Content="{DynamicResource Select}" />
<TextBlock
Grid.Row="2"
Grid.Row="3"
Grid.Column="0"
Margin="10"
Block.TextAlignment="Center"
@@ -70,7 +81,7 @@
Text="{DynamicResource ConnectionAddress}"
TextWrapping="Wrap" />
<TextBox
Grid.Row="2"
Grid.Row="3"
Grid.Column="1"
Width="250"
Height="30"
@@ -80,7 +91,7 @@
ToolTip="{DynamicResource ConnectionAddressTip}" />
<TextBlock
Grid.Row="3"
Grid.Row="4"
Grid.Column="0"
Margin="10"
Block.TextAlignment="Center"
@@ -88,7 +99,7 @@
Text="{DynamicResource ConnectionPreset}"
TextWrapping="Wrap" />
<ComboBox
Grid.Row="3"
Grid.Row="4"
Grid.Column="1"
Width="250"
Height="30"
@@ -100,7 +111,8 @@
SelectedValuePath="Value" />
<CheckBox
Grid.Row="4"
Grid.Row="5"
Grid.Column="0"
Grid.ColumnSpan="2"
Margin="15"
VerticalAlignment="Center"

View File

@@ -1620,6 +1620,18 @@ namespace MeoAsstGui
}
}
private bool _alwaysAutoDetectConnection = bool.Parse(ViewStatusStorage.Get("Connect.AlwaysAutoDetect", false.ToString()));
public bool AlwaysAutoDetectConnection
{
get => _alwaysAutoDetectConnection;
set
{
SetAndNotify(ref _alwaysAutoDetectConnection, value);
ViewStatusStorage.Set("Connect.AlwaysAutoDetect", value.ToString());
}
}
private string _connectAddress = ViewStatusStorage.Get("Connect.Address", string.Empty);
/// <summary>