Browse Source

Recipe Copy问题

jiangjy 2 days ago
parent
commit
3f9c35abed

+ 24 - 18
Furnace/FurnaceUI/Views/Recipes/RecipeJobViewModel.cs

@@ -1260,29 +1260,35 @@ namespace FurnaceUI.Views.Recipes
             _recipeProvider.SaveAsRecipe(prefix, recipeName, CurrentRecipe.GetXmlString());
 
 
-            prefix = GetPrefix(prefix, CurrentFileNode);
-            if (selectNode.Name == prefix)
+            prefix = "";
+            if (filepath.Contains("\\"))
             {
-                ReloadRecipeFileList(CurrentChamberType, CurrentProcessType, recipeName, false);
+                prefix = filepath;
             }
             else
             {
-                ProcessTypeFileItem item = ProcessTypeFileList.FirstOrDefault(x => x.ProcessType == CurrentProcessType);
-                item.FileListByProcessType = RecipeSequenceTreeBuilder.GetFileNodeParameterList($"{ChamberType[ChamberTypeIndexSelection]}\\{item.ProcessType}");// RecipeSequenceTreeBuilder.BuildFileNode(prefix, selectedFile, selectionIsFolder, recipes)[0].Files;
-                FindSelectedFile(item.FileListByProcessType, $"{$"{ChamberType[ChamberTypeIndexSelection]}\\{item.ProcessType}"}\\{recipeName}");
-
-                item.FileListByProcessType.ForEachDo(a =>
+                prefix = CurrentChamberType + "\\" + CurrentProcessType + "\\" + filepath;
+                if (CurrentFileNode != null)
                 {
-                    a.IsSelected = false;
-                    if (a.FullPath == prefix)
-                    {
-                        a.IsSelected = true;
-                        RecipeFileList = a.Files.ToList();
-                        return;
-                    }
-                });
-
+                    //获取目录
+                    prefix = GetPrefix(CurrentFileNode.PrefixPath, CurrentFileNode);
+                }
             }
+
+            ProcessTypeFileItem item = ProcessTypeFileList.FirstOrDefault(x => x.ProcessType == CurrentProcessType);
+            item.FileListByProcessType = RecipeSequenceTreeBuilder.GetFileNodeParameterList($"{ChamberType[ChamberTypeIndexSelection]}\\{item.ProcessType}");// RecipeSequenceTreeBuilder.BuildFileNode(prefix, selectedFile, selectionIsFolder, recipes)[0].Files;
+            FindSelectedFile(item.FileListByProcessType, $"{$"{ChamberType[ChamberTypeIndexSelection]}\\{item.ProcessType}"}\\{recipeName}");
+            TreeSelectChanged(CurrentFileNode);
+            item.FileListByProcessType.ForEachDo(a =>
+            {
+                a.IsSelected = false;
+                if (a.FullPath == prefix)
+                {
+                    a.IsSelected = true;
+                    RecipeFileList = a.Files.ToList();
+                    return;
+                }
+            });
         }
 
 
@@ -1656,7 +1662,7 @@ namespace FurnaceUI.Views.Recipes
                 return;
             }
 
-               CurrentRecipe.RecipeChamberType = "OriginChamber";
+            CurrentRecipe.RecipeChamberType = "OriginChamber";
             CurrentRecipe.RecipeVersion = _columnBuilder.RecipeVersion;
             CurrentRecipe.InitData(prefixPath, recipeName, recipeContent, SelectedChamber);
 

+ 25 - 18
Furnace/FurnaceUI/Views/Recipes/RecipeLayoutViewModel.cs

@@ -1271,29 +1271,36 @@ namespace FurnaceUI.Views.Recipes
 
             _recipeProvider.SaveAsRecipe(prefix, recipeName, CurrentRecipe.GetXmlString());
 
-            prefix = GetPrefix(prefix, CurrentFileNode);
-            if (selectNode.Name == prefix)
+            prefix = "";
+            if (filepath.Contains("\\"))
             {
-                ReloadRecipeFileList(CurrentChamberType, CurrentProcessType, recipeName, false);
+                prefix = filepath;
             }
             else
             {
-                ProcessTypeFileItem item = ProcessTypeFileList.FirstOrDefault(x => x.ProcessType == CurrentProcessType);
-                item.FileListByProcessType = RecipeSequenceTreeBuilder.GetFileNodeParameterList($"{ChamberType[ChamberTypeIndexSelection]}\\{item.ProcessType}");// RecipeSequenceTreeBuilder.BuildFileNode(prefix, selectedFile, selectionIsFolder, recipes)[0].Files;
-                FindSelectedFile(item.FileListByProcessType, $"{$"{ChamberType[ChamberTypeIndexSelection]}\\{item.ProcessType}"}\\{recipeName}");
+                prefix = CurrentChamberType + "\\" + CurrentProcessType + "\\" + filepath;
+                if (CurrentFileNode != null)
+                {
+                    //获取目录
+                    prefix = GetPrefix(CurrentFileNode.PrefixPath, CurrentFileNode);
+                }
+            }
 
-                item.FileListByProcessType.ForEachDo(a =>
+            ProcessTypeFileItem item = ProcessTypeFileList.FirstOrDefault(x => x.ProcessType == CurrentProcessType);
+            item.FileListByProcessType = RecipeSequenceTreeBuilder.GetFileNodeParameterList($"{ChamberType[ChamberTypeIndexSelection]}\\{item.ProcessType}");// RecipeSequenceTreeBuilder.BuildFileNode(prefix, selectedFile, selectionIsFolder, recipes)[0].Files;
+            FindSelectedFile(item.FileListByProcessType, $"{$"{ChamberType[ChamberTypeIndexSelection]}\\{item.ProcessType}"}\\{recipeName}");
+            TreeSelectChanged(CurrentFileNode);
+            item.FileListByProcessType.ForEachDo(a =>
+            {
+                a.IsSelected = false;
+                if (a.FullPath == prefix)
                 {
-                    a.IsSelected = false;
-                    if (a.FullPath == prefix)
-                    {
-                        a.IsSelected = true;
-                        RecipeFileList = a.Files.ToList();
-                        return;
-                    }
-                });
+                    a.IsSelected = true;
+                    RecipeFileList = a.Files.ToList();
+                    return;
+                }
+            });
 
-            }
         }
 
 
@@ -1626,11 +1633,11 @@ namespace FurnaceUI.Views.Recipes
                 return;
             }
 
-           CurrentRecipe.RecipeChamberType = "OriginChamber";
+            CurrentRecipe.RecipeChamberType = "OriginChamber";
             CurrentRecipe.RecipeVersion = _columnBuilder.RecipeVersion;
             _columnBuilder.Build(CurrentProcessType);
             CurrentRecipe.InitData(prefixPath, recipeName, recipeContent, _columnBuilder.Configs, SelectedChamber);
-      
+
             this.editMode = EditMode.Normal;
         }
 

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

@@ -1333,31 +1333,39 @@ namespace FurnaceUI.Views.Recipes
             CurrentRecipe.Description = string.IsNullOrEmpty(dialog.Comment) ? CurrentRecipe.Description + ". Renamed from " + CurrentFileNode.Name : dialog.Comment;
 
             _recipeProvider.SaveAsRecipe(prefix, recipeName, CurrentRecipe.GetXmlString());
+            //ReloadRecipeFileList(types[0], types[1], newfile, false);
 
-
-            prefix = GetPrefix(prefix, CurrentFileNode);
-            if (selectNode.Name == prefix)
+            prefix = "";
+            if (filepath.Contains("\\"))
             {
-                ReloadRecipeFileList(CurrentChamberType, CurrentProcessType, recipeName, false);
+                prefix = filepath;
             }
             else
             {
-                ProcessTypeFileItem item = ProcessTypeFileList.FirstOrDefault(x => x.ProcessType == CurrentProcessType);
-                item.FileListByProcessType = RecipeSequenceTreeBuilder.GetFileNodeParameterList($"{ChamberType[ChamberTypeIndexSelection]}\\{item.ProcessType}");// RecipeSequenceTreeBuilder.BuildFileNode(prefix, selectedFile, selectionIsFolder, recipes)[0].Files;
-                FindSelectedFile(item.FileListByProcessType, $"{$"{ChamberType[ChamberTypeIndexSelection]}\\{item.ProcessType}"}\\{recipeName}");
+                prefix = CurrentChamberType + "\\" + CurrentProcessType + "\\" + filepath;
+                if (CurrentFileNode != null)
+                {
+                    //获取目录
+                    prefix = GetPrefix(CurrentFileNode.PrefixPath, CurrentFileNode);
+                }
+            }
 
-                item.FileListByProcessType.ForEachDo(a =>
+            ProcessTypeFileItem item = ProcessTypeFileList.FirstOrDefault(x => x.ProcessType == CurrentProcessType);
+            item.FileListByProcessType = RecipeSequenceTreeBuilder.GetFileNodeParameterList($"{ChamberType[ChamberTypeIndexSelection]}\\{item.ProcessType}");// RecipeSequenceTreeBuilder.BuildFileNode(prefix, selectedFile, selectionIsFolder, recipes)[0].Files;
+            FindSelectedFile(item.FileListByProcessType, $"{$"{ChamberType[ChamberTypeIndexSelection]}\\{item.ProcessType}"}\\{recipeName}");
+            TreeSelectChanged(CurrentFileNode);
+            item.FileListByProcessType.ForEachDo(a =>
+            {
+                a.IsSelected = false;
+                if (a.FullPath == prefix)
                 {
-                    a.IsSelected = false;
-                    if (a.FullPath == prefix)
-                    {
-                        a.IsSelected = true;
-                        RecipeFileList = a.Files.ToList();
-                        return;
-                    }
-                });
+                    a.IsSelected = true;
+                    RecipeFileList = a.Files.ToList();
+                    return;
+                }
+            });
+
 
-            }
         }