|
@@ -2356,17 +2356,30 @@ namespace MECF.Framework.UI.Client.CenterViews.Editors.Recipe
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private class StepInfo
|
|
|
+ {
|
|
|
+ public StepInfo(int stepNo, Step step)
|
|
|
+ {
|
|
|
+ StepNo = StepNo;
|
|
|
+ Step = step;
|
|
|
+ }
|
|
|
+ public int StepNo { get; }
|
|
|
+ public Step Step { get; }
|
|
|
+ }
|
|
|
+
|
|
|
+ private readonly ConcurrentDictionary<int, StepInfo> _StepCache = new ConcurrentDictionary<int, StepInfo>();
|
|
|
+
|
|
|
private void FastLoadSteps(XmlNodeList steps)
|
|
|
{
|
|
|
Steps.Clear();
|
|
|
PopSettingSteps.Clear();
|
|
|
StepTolerances.Clear();
|
|
|
StepNos.Clear();
|
|
|
+ this._StepCache.Clear();
|
|
|
|
|
|
if (steps.Count == 0)
|
|
|
return;
|
|
|
|
|
|
- ConcurrentDictionary<int, Step> cache = new ConcurrentDictionary<int, Step>();
|
|
|
Step step = this.CreateStep(steps[0]);
|
|
|
StepNos.Add(step.StepNo);
|
|
|
Steps.Add(step);
|
|
@@ -2374,13 +2387,16 @@ namespace MECF.Framework.UI.Client.CenterViews.Editors.Recipe
|
|
|
Parallel.For(1, steps.Count - 1, index =>
|
|
|
{
|
|
|
Step tempStep = CreateStep(step, steps.Item(index));
|
|
|
- cache[tempStep.StepNo] = tempStep;
|
|
|
+ _StepCache[index] = new StepInfo(tempStep.StepNo, tempStep);
|
|
|
});
|
|
|
|
|
|
- foreach (var item in cache)
|
|
|
+ for (int i = 1; i <= _StepCache.Count; i++)
|
|
|
{
|
|
|
- StepNos.Add(item.Key);
|
|
|
- Steps.Add(item.Value);
|
|
|
+ if (!_StepCache.TryGetValue(i, out StepInfo stepInfo) || stepInfo is null)
|
|
|
+ continue;
|
|
|
+
|
|
|
+ StepNos.Add(stepInfo.StepNo);
|
|
|
+ Steps.Add(stepInfo.Step);
|
|
|
}
|
|
|
|
|
|
//if (steps.Count != 0)
|