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)