diff --git a/src/MaaWpfGui/ViewModels/UI/TaskQueueViewModel.cs b/src/MaaWpfGui/ViewModels/UI/TaskQueueViewModel.cs index 9f72795970..cbaefb66ed 100644 --- a/src/MaaWpfGui/ViewModels/UI/TaskQueueViewModel.cs +++ b/src/MaaWpfGui/ViewModels/UI/TaskQueueViewModel.cs @@ -1623,7 +1623,7 @@ namespace MaaWpfGui.ViewModels.UI public void SetFightParams() { var type = TaskType.Fight; - var id = Instances.AsstProxy.TaskStatus.FirstOrDefault(t => t.Value == type).Key; + var id = Instances.AsstProxy.TaskStatus.ToList().FirstOrDefault(t => t.Value == type).Key; if (!EnableSetFightParams || id == default) { return; @@ -1636,7 +1636,7 @@ namespace MaaWpfGui.ViewModels.UI public static void SetFightRemainingSanityParams() { var type = TaskType.FightRemainingSanity; - var id = Instances.AsstProxy.TaskStatus.FirstOrDefault(t => t.Value == type).Key; + var id = Instances.AsstProxy.TaskStatus.ToList().FirstOrDefault(t => t.Value == type).Key; if (id == default) { return; @@ -1663,7 +1663,7 @@ namespace MaaWpfGui.ViewModels.UI public static void SetInfrastParams() { const TaskType Type = TaskType.Infrast; - int id = Instances.AsstProxy.TaskStatus.FirstOrDefault(i => i.Value == Type).Key; + int id = Instances.AsstProxy.TaskStatus.ToList().FirstOrDefault(i => i.Value == Type).Key; if (id == default) { return; diff --git a/src/MaaWpfGui/ViewModels/UserControl/TaskQueue/FightSettingsUserControlModel.cs b/src/MaaWpfGui/ViewModels/UserControl/TaskQueue/FightSettingsUserControlModel.cs index d5adc2b101..a6bfcc1315 100644 --- a/src/MaaWpfGui/ViewModels/UserControl/TaskQueue/FightSettingsUserControlModel.cs +++ b/src/MaaWpfGui/ViewModels/UserControl/TaskQueue/FightSettingsUserControlModel.cs @@ -241,10 +241,10 @@ public class FightSettingsUserControlModel : TaskViewModel /// public void RemoveNonExistStage() { - Stage1 = StageList.Where(x => x.Value == Stage1).FirstOrDefault()?.Value ?? string.Empty; - Stage2 = StageList.Where(x => x.Value == Stage2).FirstOrDefault()?.Value ?? string.Empty; - Stage3 = StageList.Where(x => x.Value == Stage3).FirstOrDefault()?.Value ?? string.Empty; - RemainingSanityStage = RemainingSanityStageList.Where(x => x.Value == RemainingSanityStage).FirstOrDefault()?.Value ?? string.Empty; + Stage1 = StageList.FirstOrDefault(x => x.Value == Stage1)?.Value ?? string.Empty; + Stage2 = StageList.FirstOrDefault(x => x.Value == Stage2)?.Value ?? string.Empty; + Stage3 = StageList.FirstOrDefault(x => x.Value == Stage3)?.Value ?? string.Empty; + RemainingSanityStage = RemainingSanityStageList.FirstOrDefault(x => x.Value == RemainingSanityStage)?.Value ?? string.Empty; } private string _remainingSanityStage = ConfigurationHelper.GetValue(ConfigurationKeys.RemainingSanityStage, string.Empty) ?? string.Empty;