From 072592c49ab1fa5bda249dff211cce5f87e1a0dc Mon Sep 17 00:00:00 2001 From: status102 <102887808+status102@users.noreply.github.com> Date: Tue, 22 Apr 2025 11:18:42 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BB=BB=E5=8A=A1=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E6=9F=A5=E5=89=AF=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix #12426 --- src/MaaWpfGui/ViewModels/UI/TaskQueueViewModel.cs | 6 +++--- .../TaskQueue/FightSettingsUserControlModel.cs | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) 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;