diff --git a/src/MeoAsstGui/Helper/AsstProxy.cs b/src/MeoAsstGui/Helper/AsstProxy.cs
index 24e2feaf7e..993144620f 100644
--- a/src/MeoAsstGui/Helper/AsstProxy.cs
+++ b/src/MeoAsstGui/Helper/AsstProxy.cs
@@ -988,9 +988,8 @@ namespace MeoAsstGui
/// 连接模拟器。
///
/// 具体的连接错误。
- /// 是否为第一次尝试。
/// 是否成功。
- public bool AsstConnect(ref string error, bool first_try = false)
+ public bool AsstConnect(ref string error)
{
if (!LoadGlobalResource())
{
@@ -999,28 +998,29 @@ namespace MeoAsstGui
}
var settings = _container.Get();
- if (connected
+
+ settings.TryToSetBlueStacksHyperVAddress();
+
+ if (!settings.AutoDetectConnection
+ && connected
&& connectedAdb == settings.AdbPath
&& connectedAddress == settings.ConnectAddress)
{
return true;
}
- if (settings.AdbPath == string.Empty ||
- settings.ConnectAddress == string.Empty)
+ if (settings.AutoDetectConnection)
{
- if (!settings.RefreshAdbConfig(ref error))
+ if (!settings.DetectAdbConfig(ref error))
{
return false;
}
}
- settings.TryToSetBlueStacksHyperVAddress();
-
bool ret = AsstConnect(_handle, settings.AdbPath, settings.ConnectAddress, settings.ConnectConfig);
// 尝试默认的备选端口
- if (!ret)
+ if (!ret && settings.AutoDetectConnection)
{
foreach (var address in settings.DefaultAddress[settings.ConnectConfig])
{
@@ -1038,16 +1038,13 @@ namespace MeoAsstGui
}
}
- if (!ret)
+ if (ret)
{
- if (first_try)
- {
- error = Localization.GetString("ConnectFailed") + "\n" + Localization.GetString("TryToStartEmulator");
- }
- else
- {
- error = Localization.GetString("ConnectFailed") + "\n" + Localization.GetString("CheckSettings");
- }
+ settings.AutoDetectConnection = false;
+ }
+ else
+ {
+ error = Localization.GetString("ConnectFailed") + "\n" + Localization.GetString("CheckSettings");
}
return ret;
diff --git a/src/MeoAsstGui/Resources/Localizations/en-us.xaml b/src/MeoAsstGui/Resources/Localizations/en-us.xaml
index 4d548d76fd..38695d2e67 100644
--- a/src/MeoAsstGui/Resources/Localizations/en-us.xaml
+++ b/src/MeoAsstGui/Resources/Localizations/en-us.xaml
@@ -149,7 +149,8 @@
Manual entry of level names
Support all main line level names + level names from the original list (e.g. 4-10, 6-16, etc.)
- Tip: It will be automatically detected here. If there is an error, you can try to modify it again, otherwise you do not need to fill in it yourself
+ Auto detect connection
+ The checkbox will be automatically unchecked after each detect is completed, and can be checked again if you need to re-detect
ADB path (rel/abs)
Connection address
It will be filled in automatically when you use it for the first time. If you encounter any problems, you can try to manually modify it
diff --git a/src/MeoAsstGui/Resources/Localizations/ja-jp.xaml b/src/MeoAsstGui/Resources/Localizations/ja-jp.xaml
index 5f20c30004..d109207662 100644
--- a/src/MeoAsstGui/Resources/Localizations/ja-jp.xaml
+++ b/src/MeoAsstGui/Resources/Localizations/ja-jp.xaml
@@ -160,7 +160,7 @@
ヒント:接続時に自動的に検出されますが、エラーが発生した場合は変更を試みることができます。通常は自分で入力する必要はありません。
adbパス(相対/絶対)
接続先アドレス
- 初めて使用した際に自動で記入されますが、問題があれば手動で修正してください。
+ 問題があれば手動で修正してください。
接続構成
adb再接続失敗時にエミュレータを自動で再起動
再接続に20回失敗した後、エミュレータを再起動してみてください,バックグラウンドのタイムドタスクを使用し、終了時にエミュレータを終了させるタスクを設定する場合は、必ずチェックを入れること
diff --git a/src/MeoAsstGui/Resources/Localizations/ko-kr.xaml b/src/MeoAsstGui/Resources/Localizations/ko-kr.xaml
index 6e981f1f4b..ec952e654e 100644
--- a/src/MeoAsstGui/Resources/Localizations/ko-kr.xaml
+++ b/src/MeoAsstGui/Resources/Localizations/ko-kr.xaml
@@ -151,7 +151,7 @@
팁: 여기에서 자동으로 감지됩니다. 오류가 있는 경우 다시 수정을 시도할 수 있습니다. 그렇지 않으면 직접 입력할 필요가 없습니다.
adb 경로 (상대/절대)
연결 주소
- 처음 사용할 때는 자동으로 작성되며, 문제가 있으면 수동으로 수정하십시오
+ 문제가 있으면 수동으로 수정하십시오
연결 사전 설정
adb 재연결이 실패하면 자동으로 에뮬레이터를 다시 시작합니다
20번의 재연결 실패 후 에뮬레이터를 다시 시작하십시오, 백그라운드 시간 지정 작업을 사용하고 작업이 완료되면 시뮬레이터를 닫도록 설정하려면 다음을 선택해야 합니다
diff --git a/src/MeoAsstGui/Resources/Localizations/zh-cn.xaml b/src/MeoAsstGui/Resources/Localizations/zh-cn.xaml
index 2ee74c9322..8e0bfd80e4 100644
--- a/src/MeoAsstGui/Resources/Localizations/zh-cn.xaml
+++ b/src/MeoAsstGui/Resources/Localizations/zh-cn.xaml
@@ -155,13 +155,14 @@
手动输入关卡名
支持所有主线关卡名 + 原列表中的关卡名(如 4-10、6-16 等)
- 小提示:这里会自动检测的,若出现问题可再尝试修改,否则不需要自行填写
+ 自动检测连接
+ 每次检测完成后会自动取消勾选,若需要重新检测可再次勾选
adb 路径 (相对/绝对)
连接地址
- 第一次使用会自动填写,若遇到问题可尝试手动修改
+ 若遇到问题可尝试手动修改
连接配置
adb 重连失败时自动重启模拟器
- 重连失败 20 次后尝试重启模拟器,使用后台定时任务且设置任务完成关闭模拟器时必须勾选
+ 重连失败 20 次后尝试重启模拟器,使用后台定时任务且设置任务完成关闭模拟器时请勾选
diff --git a/src/MeoAsstGui/Resources/Localizations/zh-tw.xaml b/src/MeoAsstGui/Resources/Localizations/zh-tw.xaml
index 5f12971ca1..4a72606d25 100644
--- a/src/MeoAsstGui/Resources/Localizations/zh-tw.xaml
+++ b/src/MeoAsstGui/Resources/Localizations/zh-tw.xaml
@@ -151,7 +151,7 @@
小提示:這裡會自動檢測的,若出現問題可再嘗試修改,否則不需要自行填寫
adb 路徑 (相對/絕對)
連接地址
- 第一次使用會自動填寫,若遇到問題可嘗試手動修改
+ 若遇到問題可嘗試手動修改
連接配置
adb 重連失敗時自動重啟模擬器
重連失敗 20 次後嘗試重啟模擬器,使用後台定時任務且設置任務完成關閉模擬器時必須勾選
diff --git a/src/MeoAsstGui/UserControl/ConnectSettingsUserControl.xaml b/src/MeoAsstGui/UserControl/ConnectSettingsUserControl.xaml
index 8b77c82616..99f64e66e2 100644
--- a/src/MeoAsstGui/UserControl/ConnectSettingsUserControl.xaml
+++ b/src/MeoAsstGui/UserControl/ConnectSettingsUserControl.xaml
@@ -3,6 +3,7 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:c="clr-namespace:CalcBinding;assembly=CalcBinding"
xmlns:dd="urn:gong-wpf-dragdrop"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:s="https://github.com/canton7/Stylet"
@@ -24,14 +25,15 @@
-
+ Grid.ColumnSpan="2"
+ Margin="15"
+ VerticalAlignment="Center"
+ IsChecked="{Binding AutoDetectConnection}"
+ Content="{DynamicResource AutoDetectConnection}"
+ ToolTip="{DynamicResource AutoDetectConnectionTip}"
+ HorizontalAlignment="Center" />
@@ -71,6 +75,7 @@
Width="250"
Height="30"
Margin="10"
+ IsEnabled="{c:Binding !AutoDetectConnection}"
Text="{Binding ConnectAddress}"
ToolTip="{DynamicResource ConnectionAddressTip}" />
@@ -89,13 +94,14 @@
Height="30"
Margin="10"
DisplayMemberPath="Display"
+ IsEnabled="{c:Binding !AutoDetectConnection}"
ItemsSource="{Binding ConnectConfigList}"
SelectedValue="{Binding ConnectConfig}"
SelectedValuePath="Value" />
_autoDetectConnection;
+ set
+ {
+ SetAndNotify(ref _autoDetectConnection, value);
+ ViewStatusStorage.Set("Connect.AutoDetect", value.ToString());
+ }
+ }
+
private string _connectAddress = ViewStatusStorage.Get("Connect.Address", string.Empty);
///
@@ -1508,7 +1520,7 @@ namespace MeoAsstGui
///
/// Errors when doing this operation.
/// Whether the operation is successful.
- public bool RefreshAdbConfig(ref string error)
+ public bool DetectAdbConfig(ref string error)
{
var adapter = new WinAdapter();
List emulators;
diff --git a/src/MeoAsstGui/ViewModels/TaskQueueViewModel.cs b/src/MeoAsstGui/ViewModels/TaskQueueViewModel.cs
index f60108e948..d802a0fca6 100644
--- a/src/MeoAsstGui/ViewModels/TaskQueueViewModel.cs
+++ b/src/MeoAsstGui/ViewModels/TaskQueueViewModel.cs
@@ -628,7 +628,7 @@ namespace MeoAsstGui
string errMsg = string.Empty;
var task = Task.Run(() =>
{
- return asstProxy.AsstConnect(ref errMsg, true);
+ return asstProxy.AsstConnect(ref errMsg);
});
bool caught = await task;
@@ -641,6 +641,7 @@ namespace MeoAsstGui
if (!caught)
{
AddLog(errMsg, LogColor.Error);
+ AddLog(Localization.GetString("ConnectFailed") + "\n" + Localization.GetString("TryToStartEmulator"));
var settingsModel = _container.Get();
var subtask = Task.Run(() =>
{