[UI.Client]

修正删除Recipe步骤后,Recipe的变更状态仍然为“未变更”的问题。
This commit is contained in:
Liang Su 2023-06-19 17:04:40 +08:00
parent 04666ca896
commit f84d2019ed
2 changed files with 14 additions and 16 deletions

View File

@ -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<string, RecipeStepCollection> popSteps)
{
foreach (var parameters in popSteps.Values)
foreach (var steps in popSteps.Values)
{
if (ChkChanged(parameters))
{
if (ChkChanged(steps))
return true;
}
}
return false;
}

View File

@ -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)