feat: 将自动重载资源独立出来,在 debug 模式下显示勾选框

This commit is contained in:
uye
2026-01-09 01:03:16 +08:00
parent 867dc3f7ec
commit aef75b9e06
3 changed files with 32 additions and 4 deletions

View File

@@ -2269,8 +2269,6 @@ public class AsstProxy
return MaaService.AsstSetStaticOption(key, value);
}
private static readonly bool _forcedReloadResource = Instances.VersionUpdateViewModel.IsDebugVersion() || File.Exists("DEBUG") || File.Exists("DEBUG.txt");
/// <summary>
/// 使用 TCP 或 adb devices 命令检查连接。TCP 检测相比 adb devices 更快,但不支持实体机。
/// </summary>
@@ -2366,7 +2364,7 @@ public class AsstProxy
else
{
_logger.Information("Already connected to {ConnectedAdb} {ConnectedAddress}", _connectedAdb, _connectedAddress);
if (!_forcedReloadResource)
if (!Instances.TaskQueueViewModel.EnableAutoReload)
{
return true;
}

View File

@@ -903,6 +903,7 @@ public class TaskQueueViewModel : Screen
if (Instances.VersionUpdateViewModel.IsDebugVersion() || File.Exists("DEBUG") || File.Exists("DEBUG.txt"))
{
taskList.Add("Custom");
CanShowAutoReload = true;
}
var tempOrderList = new List<DragItemViewModel?>(new DragItemViewModel[taskList.Count]);
@@ -1478,6 +1479,22 @@ public class TaskQueueViewModel : Screen
}
}
private bool _canShowAutoReload;
public bool CanShowAutoReload
{
get => _canShowAutoReload;
set => SetAndNotify(ref _canShowAutoReload, value);
}
private bool _enableAutoReload;
public bool EnableAutoReload
{
get => _enableAutoReload;
set => SetAndNotify(ref _enableAutoReload, value);
}
private DateTime? _taskStartTime;
/// <summary>

View File

@@ -245,7 +245,14 @@
</hc:ButtonGroup>
</StackPanel>
<Grid Grid.Row="2" Height="60">
<Grid
Grid.Row="2"
Height="Auto"
HorizontalAlignment="Center">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Button
Width="100"
Height="50"
@@ -269,6 +276,12 @@
Command="{s:Action WaitAndStop}"
Content="{DynamicResource WaitAndStop}"
Visibility="{c:Binding 'Inited and !Idle and (RoguelikeInCombatAndShowWait and !Waiting)'}" />
<CheckBox
Grid.Row="1"
VerticalAlignment="Center"
Content="Auto Reload Resource"
IsChecked="{Binding EnableAutoReload}"
Visibility="{c:Binding CanShowAutoReload}" />
</Grid>
<!--<StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment ="Center" >-->