Browse Source

fix 前后屏 Recipe 列表不同步

jiangjy 6 days ago
parent
commit
0d77ed2c53

+ 23 - 11
Furnace/FurnaceUI/Views/Recipes/RecipeJobViewModel.cs

@@ -381,7 +381,7 @@ namespace FurnaceUI.Views.Recipes
 
 
 
-        private void InitializeDefault()
+        private void InitializeDefault(bool isLoadOtherData = true)
         {
             var chamberType = QueryDataClient.Instance.Service.GetConfig("System.Recipe.SupportedChamberType");
             ChamberType.Clear();
@@ -420,18 +420,22 @@ namespace FurnaceUI.Views.Recipes
             }
             //if (ProcessTypeFileList[0].FileListByProcessType.Count > 0)
             //    CurrentFileNode = ProcessTypeFileList[0].FileListByProcessType[ProcessTypeFileList[0].FileListByProcessType.Count - 1];
-            SelectRecipeTypeName = processType + " Recipe";
-            UpdateRecipeFormat();
-            if (CurrentFileNode != null && CurrentFileNode.IsFile)
+            if (isLoadOtherData)
             {
-                if (CurrentRecipe != null)
+                SelectRecipeTypeName = processType + " Recipe";
+                UpdateRecipeFormat();
+                if (CurrentFileNode != null && CurrentFileNode.IsFile)
                 {
-                    CurrentRecipe.PrefixPath = CurrentFileNode.PrefixPath;
-                    CurrentRecipe.Name = CurrentFileNode.FullPath;
+                    if (CurrentRecipe != null)
+                    {
+                        CurrentRecipe.PrefixPath = CurrentFileNode.PrefixPath;
+                        CurrentRecipe.Name = CurrentFileNode.FullPath;
+                    }
+                    //this.LoadData(CurrentFileNode.PrefixPath, CurrentFileNode.FullPath);
                 }
-                //this.LoadData(CurrentFileNode.PrefixPath, CurrentFileNode.FullPath);
+                GetRecipeType();
             }
-            GetRecipeType();
+
         }
 
         private void GetRecipeType()
@@ -550,6 +554,14 @@ namespace FurnaceUI.Views.Recipes
                     //  this.Save(this.CurrentRecipe, false);
                 }
             }
+            if (node != null && node.IsFile)
+            {
+
+            }
+            else
+            {
+                InitializeDefault(false);
+            }
             if (node != null && !node.IsFile)
             {
                 ProcessTypeFileList[0].FileListByProcessType.ForEachDo(a =>
@@ -938,7 +950,7 @@ namespace FurnaceUI.Views.Recipes
             string recipeName = dialog.FileName.Trim();
             string filepath = dialog.FilePath;
             string description = dialog.Comment;
-         
+
 
             string prefix;
             if (filepath.Contains("\\"))
@@ -954,7 +966,7 @@ namespace FurnaceUI.Views.Recipes
                     prefix = GetPrefix(CurrentFileNode.PrefixPath, CurrentFileNode);
                 }
             }
-            if (RecipeFileList!=null&&RecipeFileList.Find(a => a.Name == recipeName.ToLower()) != null)
+            if (RecipeFileList != null && RecipeFileList.Find(a => a.Name == recipeName.ToLower()) != null)
             {
                 DialogBox.ShowWarning($"Can not create {recipeName}, Recipe with the same name already exist.");
                 return;

+ 22 - 10
Furnace/FurnaceUI/Views/Recipes/RecipeLayoutViewModel.cs

@@ -373,7 +373,7 @@ namespace FurnaceUI.Views.Recipes
 
 
 
-        private void InitializeDefault()
+        private void InitializeDefault(bool isLoadOtherData = true)
         {
             var chamberType = QueryDataClient.Instance.Service.GetConfig("System.Recipe.SupportedChamberType");
             ChamberType.Clear();
@@ -412,19 +412,23 @@ namespace FurnaceUI.Views.Recipes
             }
             //if (ProcessTypeFileList[0].FileListByProcessType.Count > 0)
             //    CurrentFileNode = ProcessTypeFileList[0].FileListByProcessType[ProcessTypeFileList[0].FileListByProcessType.Count - 1];
-            SelectRecipeTypeName = processType + " Recipe";
-            UpdateRecipeFormat();
-            if (CurrentFileNode != null && CurrentFileNode.IsFile)
+            if (isLoadOtherData)
             {
-                if (CurrentRecipe != null)
+                SelectRecipeTypeName = processType + " Recipe";
+                UpdateRecipeFormat();
+                if (CurrentFileNode != null && CurrentFileNode.IsFile)
                 {
-                    CurrentRecipe.PrefixPath = CurrentFileNode.PrefixPath;
-                    CurrentRecipe.Name = CurrentFileNode.FullPath;
+                    if (CurrentRecipe != null)
+                    {
+                        CurrentRecipe.PrefixPath = CurrentFileNode.PrefixPath;
+                        CurrentRecipe.Name = CurrentFileNode.FullPath;
+                    }
+                    //this.LoadData(CurrentFileNode.PrefixPath, CurrentFileNode.FullPath);
                 }
-                //this.LoadData(CurrentFileNode.PrefixPath, CurrentFileNode.FullPath);
+                GetRecipeType();
+                _columnBuilder.Build(CurrentProcessType);
             }
-            GetRecipeType();
-            _columnBuilder.Build(CurrentProcessType);
+
         }
 
         private void GetRecipeType()
@@ -541,6 +545,14 @@ namespace FurnaceUI.Views.Recipes
                     //  this.Save(this.CurrentRecipe, false);
                 }
             }
+            if (node != null && node.IsFile)
+            {
+
+            }
+            else
+            {
+                InitializeDefault(false);
+            }
             if (node != null && !node.IsFile)
             {
                 ProcessTypeFileList[0].FileListByProcessType.ForEachDo(a =>

+ 25 - 9
Furnace/FurnaceUI/Views/Recipes/RecipeViewModel.cs

@@ -403,8 +403,9 @@ namespace FurnaceUI.Views.Recipes
 
 
 
-        private void InitializeDefault()
+        private void InitializeDefault(bool isLoadOtherData = true)
         {
+            ProcessTypeFileList.Clear();
             var chamberType = QueryDataClient.Instance.Service.GetConfig("System.Recipe.SupportedChamberType");
             ChamberType.Clear();
             if (chamberType == null)
@@ -442,18 +443,23 @@ namespace FurnaceUI.Views.Recipes
             }
             //if (ProcessTypeFileList[0].FileListByProcessType.Count > 0)
             //    CurrentFileNode = ProcessTypeFileList[0].FileListByProcessType[ProcessTypeFileList[0].FileListByProcessType.Count - 1];
-            SelectRecipeTypeName = processType + " Recipe";
-            UpdateRecipeFormat();
-            if (CurrentFileNode != null && CurrentFileNode.IsFile)
+
+            if (isLoadOtherData)
             {
-                if (CurrentRecipe != null)
+                SelectRecipeTypeName = processType + " Recipe";
+                UpdateRecipeFormat();
+                if (CurrentFileNode != null && CurrentFileNode.IsFile)
                 {
-                    CurrentRecipe.PrefixPath = CurrentFileNode.PrefixPath;
-                    CurrentRecipe.Name = CurrentFileNode.FullPath;
+                    if (CurrentRecipe != null)
+                    {
+                        CurrentRecipe.PrefixPath = CurrentFileNode.PrefixPath;
+                        CurrentRecipe.Name = CurrentFileNode.FullPath;
+                    }
+                    //this.LoadData(CurrentFileNode.PrefixPath, CurrentFileNode.FullPath);
                 }
-                //this.LoadData(CurrentFileNode.PrefixPath, CurrentFileNode.FullPath);
+                GetRecipeType();
             }
-            GetRecipeType();
+
         }
 
         private void GetRecipeType()
@@ -585,6 +591,16 @@ namespace FurnaceUI.Views.Recipes
                     //  this.Save(this.CurrentRecipe, false);
                 }
             }
+
+
+            if (node != null && node.IsFile)
+            {
+
+            }
+            else
+            {
+                InitializeDefault(false);
+            }
             if (node != null && !node.IsFile)
             {
                 ProcessTypeFileList[0].FileListByProcessType.ForEachDo(a =>