chore: 添加模拟器路径为空的提示

This commit is contained in:
uye
2025-04-20 15:28:37 +08:00
parent 995af0fcda
commit a89f985053
6 changed files with 48 additions and 1 deletions

View File

@@ -335,6 +335,8 @@ You can cancel this popup by clicking the Settings - About Us - Issue Reporting
<system:String x:Key="EmulatorPathSelectionErrorPrompt">Do you also want to order a bar in a bar?</system:String>
<system:String x:Key="EmulatorPathSelectionErrorImSure">I'm sure I haven't selected the wrong one</system:String>
<system:String x:Key="EmulatorPathSelectionErrorSelectAgain">Okay, I will choose again</system:String>
<system:String x:Key="EmulatorPathNotExist">The emulator path does not exist</system:String>
<system:String x:Key="EmulatorPathEmptyWarning">The emulator path is empty, 「{0}」 and 「{1}」 check states have been reset</system:String>
<system:String x:Key="Select">Select</system:String>
<system:String x:Key="ForcedReplaceAdb">Replace ADB</system:String>
<system:String x:Key="TouchMode">Touch Mode</system:String>

View File

@@ -335,6 +335,8 @@
<system:String x:Key="EmulatorPathSelectionErrorPrompt">バーでバーを注文したいですか?</system:String>
<system:String x:Key="EmulatorPathSelectionErrorImSure">確かに間違って選択していないと思います</system:String>
<system:String x:Key="EmulatorPathSelectionErrorSelectAgain">はい、もう一度選択します</system:String>
<system:String x:Key="EmulatorPathNotExist">エミュレータのパスが存在しません</system:String>
<system:String x:Key="EmulatorPathEmptyWarning">エミュレータのパスが空です。「{0}」 と 「{1}」 のチェック状態がリセットされました</system:String>
<system:String x:Key="Select">選択</system:String>
<system:String x:Key="ForcedReplaceAdb">ADB強制置き換え</system:String>
<system:String x:Key="TouchMode">タッチモード</system:String>

View File

@@ -335,6 +335,8 @@
<system:String x:Key="EmulatorPathSelectionErrorPrompt">바에서 바를 주문하고 싶습니까?</system:String>
<system:String x:Key="EmulatorPathSelectionErrorImSure">잘못 선택한 것이 확실히 아닙니다</system:String>
<system:String x:Key="EmulatorPathSelectionErrorSelectAgain">다시 선택하겠습니다</system:String>
<system:String x:Key="EmulatorPathNotExist">에뮬레이터 경로가 존재하지 않습니다</system:String>
<system:String x:Key="EmulatorPathEmptyWarning">에뮬레이터 경로가 비어 있습니다. 「{0}」 및 「{1}」 선택 상태가 초기화되었습니다</system:String>
<system:String x:Key="Select">선택</system:String>
<system:String x:Key="ForcedReplaceAdb">ADB 강제 교체</system:String>
<system:String x:Key="TouchMode">터치 수행 방식</system:String>

View File

@@ -335,6 +335,8 @@
<system:String x:Key="EmulatorPathSelectionErrorPrompt">你也想在酒吧里点酒吧?</system:String>
<system:String x:Key="EmulatorPathSelectionErrorImSure">我确定没选错</system:String>
<system:String x:Key="EmulatorPathSelectionErrorSelectAgain">好的,我会重新选择</system:String>
<system:String x:Key="EmulatorPathNotExist">模拟器路径不存在</system:String>
<system:String x:Key="EmulatorPathEmptyWarning">模拟器路径为空,「{0}」与「{1}」勾选状态已被还原</system:String>
<system:String x:Key="Select">选择</system:String>
<system:String x:Key="ForcedReplaceAdb">强制替换 ADB</system:String>
<system:String x:Key="TouchMode">触控模式</system:String>

View File

@@ -335,6 +335,8 @@
<system:String x:Key="EmulatorPathSelectionErrorPrompt">你也想在酒吧裡點酒吧?</system:String>
<system:String x:Key="EmulatorPathSelectionErrorImSure">我確定沒選錯</system:String>
<system:String x:Key="EmulatorPathSelectionErrorSelectAgain">好的,我會重新選擇</system:String>
<system:String x:Key="EmulatorPathNotExist">模擬器路徑不存在</system:String>
<system:String x:Key="EmulatorPathEmptyWarning">模擬器路徑為空,「{0}」與「{1}」勾選狀態已被還原</system:String>
<system:String x:Key="Select">選擇</system:String>
<system:String x:Key="ForcedReplaceAdb">強制替換 ADB</system:String>
<system:String x:Key="TouchMode">觸控模式</system:String>

View File

@@ -22,6 +22,7 @@ using System.Management;
using System.Runtime.InteropServices.ComTypes;
using System.Threading;
using System.Windows;
using HandyControl.Controls;
using MaaWpfGui.Constants;
using MaaWpfGui.Helper;
using MaaWpfGui.Main;
@@ -116,6 +117,16 @@ public class StartSettingsUserControlModel : PropertyChangedBase
get => _openEmulatorAfterLaunch;
set
{
if (string.IsNullOrEmpty(SettingsViewModel.StartSettings.EmulatorPath))
{
MessageBoxHelper.Show(
LocalizationHelper.GetString("RetryOnDisconnectedEmulatorPathEmptyError"),
LocalizationHelper.GetString("Tip"),
MessageBoxButton.OK,
MessageBoxImage.Warning);
value = false;
}
SetAndNotify(ref _openEmulatorAfterLaunch, value);
ConfigurationHelper.SetValue(ConfigurationKeys.StartEmulator, value.ToString());
if (SettingsViewModel.GameSettings.ClientType == string.Empty && _runningState.GetIdle())
@@ -135,7 +146,15 @@ public class StartSettingsUserControlModel : PropertyChangedBase
get => _emulatorPath;
set
{
if (Path.GetFileName(value).ToLower().Contains("maa"))
value = value.Trim();
// 这里不用 SetAndNotify 判断
if (value == _emulatorPath)
{
return;
}
if (Path.GetFileName(value).Contains("maa", StringComparison.OrdinalIgnoreCase))
{
int count = 3;
while (count-- > 0)
@@ -154,6 +173,24 @@ public class StartSettingsUserControlModel : PropertyChangedBase
}
}
if (string.IsNullOrEmpty(value))
{
if (ConnectSettings.RetryOnDisconnected || OpenEmulatorAfterLaunch)
{
ConnectSettings.RetryOnDisconnected = false;
OpenEmulatorAfterLaunch = false;
Growl.Warning(
string.Format(
LocalizationHelper.GetString("EmulatorPathEmptyWarning"),
LocalizationHelper.GetString("RetryOnDisconnected"),
LocalizationHelper.GetString("OpenEmulatorAfterLaunch")));
}
}
else if (!File.Exists(EmulatorPath))
{
Growl.Warning(LocalizationHelper.GetString("EmulatorPathNotExist"));
}
SetAndNotify(ref _emulatorPath, value);
ConfigurationHelper.SetValue(ConfigurationKeys.EmulatorPath, value);
}