Browse Source

update

git-svn-id: http://10.4.3.168:50001/svn/Furnace@123 dbcde07d-dcf5-c148-8a84-ac3097b7778e
Jiangjinyuan 1 month ago
parent
commit
a668c37765
1 changed files with 21 additions and 5 deletions
  1. 21 5
      FrameworkLocal/UIClient/CenterViews/Editors/Recipe/RecipeDataBase.cs

+ 21 - 5
FrameworkLocal/UIClient/CenterViews/Editors/Recipe/RecipeDataBase.cs

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