mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-20 10:57:45 +08:00
fix: 自定义基建选择被错误重置
This commit is contained in:
@@ -41,7 +41,6 @@ using Newtonsoft.Json.Linq;
|
||||
using Serilog;
|
||||
using Stylet;
|
||||
using static MaaWpfGui.Main.AsstProxy;
|
||||
using static MaaWpfGui.States.RunningState;
|
||||
using Application = System.Windows.Application;
|
||||
using Screen = Stylet.Screen;
|
||||
using Task = System.Threading.Tasks.Task;
|
||||
@@ -1748,7 +1747,16 @@ public class TaskQueueViewModel : Screen
|
||||
return false;
|
||||
}
|
||||
|
||||
return Instances.AsstProxy.AsstAppendTaskWithEncoding(TaskType.Infrast, InfrastTask.Serialize());
|
||||
try
|
||||
{
|
||||
return Instances.AsstProxy.AsstAppendTaskWithEncoding(TaskType.Infrast, InfrastTask.Serialize());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Error(ex, "AppendInfrast error");
|
||||
AddLog("Append Infrast Error: " + ex.Message, UiLogColor.Error);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private bool _inited = false;
|
||||
|
||||
@@ -353,6 +353,16 @@ public class InfrastSettingsUserControlModel : TaskViewModel
|
||||
SetAndNotify(ref _customInfrastFile, value);
|
||||
ConfigurationHelper.SetValue(ConfigurationKeys.CustomInfrastFile, value);
|
||||
ParseCustomInfrastPlan(true);
|
||||
|
||||
int index = CustomInfrastPlanList.Any(i => i.Period.Count > 0) ? -1 : 0;
|
||||
if (index != CustomInfrastPlanSelect)
|
||||
{
|
||||
CustomInfrastPlanSelect = index;
|
||||
}
|
||||
else
|
||||
{
|
||||
NotifyOfPropertyChange(nameof(CustomInfrastPlanSelect));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -529,18 +539,6 @@ public class InfrastSettingsUserControlModel : TaskViewModel
|
||||
CustomInfrastPlanList = [];
|
||||
Instances.TaskQueueViewModel.AddLog(LocalizationHelper.GetString("CustomInfrastFileParseFailed"), UiLogColor.Error);
|
||||
}
|
||||
finally
|
||||
{
|
||||
int index = CustomInfrastPlanList.Any(i => i.Period.Count > 0) ? -1 : 0;
|
||||
if (index != CustomInfrastPlanSelect)
|
||||
{
|
||||
CustomInfrastPlanSelect = index;
|
||||
}
|
||||
else
|
||||
{
|
||||
NotifyOfPropertyChange(nameof(CustomInfrastPlanSelect));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -624,6 +622,10 @@ public class InfrastSettingsUserControlModel : TaskViewModel
|
||||
if (InfrastMode != Mode.Custom)
|
||||
{
|
||||
}
|
||||
else if (CustomInfrastPlanSelect != -1 && CustomInfrastPlanList.Count <= CustomInfrastPlanSelect)
|
||||
{
|
||||
throw new InvalidOperationException("CustomInfrastPlanSelect is out of range");
|
||||
}
|
||||
else if (CustomInfrastPlanSelect >= 0)
|
||||
{
|
||||
task.PlanIndex = CustomInfrastPlanSelect;
|
||||
|
||||
Reference in New Issue
Block a user