From f84d2019ed7692302e93ad28206f49dd231eb426 Mon Sep 17 00:00:00 2001 From: Liang Su Date: Mon, 19 Jun 2023 17:04:40 +0800 Subject: [PATCH] =?UTF-8?q?[UI.Client]=20=E4=BF=AE=E6=AD=A3=E5=88=A0?= =?UTF-8?q?=E9=99=A4Recipe=E6=AD=A5=E9=AA=A4=E5=90=8E=EF=BC=8CRecipe?= =?UTF-8?q?=E7=9A=84=E5=8F=98=E6=9B=B4=E7=8A=B6=E6=80=81=E4=BB=8D=E7=84=B6?= =?UTF-8?q?=E4=B8=BA=E2=80=9C=E6=9C=AA=E5=8F=98=E6=9B=B4=E2=80=9D=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../RecipeEditorLib/RecipeModel/RecipeData.cs | 21 +++++-------------- .../RecipeModel/RecipeStepCollection.cs | 9 ++++++++ 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/MECF.Framework.UI.Client/RecipeEditorLib/RecipeModel/RecipeData.cs b/MECF.Framework.UI.Client/RecipeEditorLib/RecipeModel/RecipeData.cs index 20d535f..1333a08 100644 --- a/MECF.Framework.UI.Client/RecipeEditorLib/RecipeModel/RecipeData.cs +++ b/MECF.Framework.UI.Client/RecipeEditorLib/RecipeModel/RecipeData.cs @@ -126,9 +126,7 @@ namespace MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel var changed = !IsSavedDesc; if (!changed) - { changed = ChkChanged(Steps) || ChkChanged(PopSettingSteps); - } if (!changed) { @@ -643,29 +641,20 @@ namespace MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel { _gasFlowCalculator?.Calculate(step, Module); } - + public bool ChkChanged(RecipeStepCollection steps) { - foreach (var parameters in steps) - { - if (parameters.FirstOrDefault(param => param.IsSaved == false) != null) - { - return true; - } - } - - return false; + return steps.IsSaved == false; } public bool ChkChanged(Dictionary popSteps) { - foreach (var parameters in popSteps.Values) + foreach (var steps in popSteps.Values) { - if (ChkChanged(parameters)) - { + if (ChkChanged(steps)) return true; - } } + return false; } diff --git a/MECF.Framework.UI.Client/RecipeEditorLib/RecipeModel/RecipeStepCollection.cs b/MECF.Framework.UI.Client/RecipeEditorLib/RecipeModel/RecipeStepCollection.cs index e35dfd6..42bd66a 100644 --- a/MECF.Framework.UI.Client/RecipeEditorLib/RecipeModel/RecipeStepCollection.cs +++ b/MECF.Framework.UI.Client/RecipeEditorLib/RecipeModel/RecipeStepCollection.cs @@ -317,6 +317,9 @@ namespace MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel UpdateStepIndex(); this[index].Validate(); + + // 强制标记为为保存状态 + IsSaved = false; } protected override void RemoveItem(int index) @@ -344,6 +347,9 @@ namespace MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel base.RemoveItem(index); UpdateStepIndex(); + + // 强制标记为为保存状态 + IsSaved = false; } protected override void ClearItems() @@ -365,6 +371,9 @@ namespace MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel } base.ClearItems(); + + // 强制标记为为保存状态 + IsSaved = false; } protected override void MoveItem(int oldIndex, int newIndex)