Browse Source

优化定位问题

jiangjy 1 month ago
parent
commit
a27289502e

+ 5 - 0
Furnace/FurnaceUI/Views/Recipes/RecipeJobView.xaml

@@ -135,6 +135,11 @@
         <Border Background="#DAE5F1" Grid.Column="1">
 
             <ListView       x:Name="RecipeFileList" HorizontalContentAlignment="Stretch" ItemsSource="{Binding RecipeFileList,UpdateSourceTrigger=PropertyChanged}">
+                <ListView.ItemContainerStyle>
+                    <Style BasedOn="{StaticResource ListViewItemBase}" TargetType="{x:Type ListViewItem}">
+                        <Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}"/>
+                    </Style>
+                </ListView.ItemContainerStyle>
                 <ListView.View>
                     <GridView>
                         <GridView.Columns>

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

@@ -196,7 +196,7 @@ namespace FurnaceUI.Views.Recipes
         private List<FileNode> _recipeFileList = new List<FileNode>();
         public List<FileNode> RecipeFileList
         {
-            get { return _recipeFileList != null ? _recipeFileList.OrderByDescending(a => a.ReviseTime).ToList() : _recipeFileList; }
+            get { return _recipeFileList; }
             set { _recipeFileList = value; this.NotifyOfPropertyChange(nameof(RecipeFileList)); }
         }
 
@@ -991,14 +991,13 @@ namespace FurnaceUI.Views.Recipes
             ProcessTypeFileItem item = ProcessTypeFileList.FirstOrDefault(x => x.ProcessType == types[1]);
             item.FileListByProcessType = RecipeSequenceTreeBuilder.GetFileNodeParameterList($"{ChamberType[ChamberTypeIndexSelection]}\\{item.ProcessType}");// RecipeSequenceTreeBuilder.BuildFileNode(prefix, selectedFile, selectionIsFolder, recipes)[0].Files;
             FindSelectedFile(item.FileListByProcessType, $"{$"{ChamberType[ChamberTypeIndexSelection]}\\{item.ProcessType}"}\\{newfile}");
-
+            TreeSelectChanged(CurrentFileNode);
             item.FileListByProcessType.ForEachDo(a =>
             {
                 a.IsSelected = false;
                 if (a.FullPath == prefix)
                 {
                     a.IsSelected = true;
-                    CurrentFileNode = a;
                     RecipeFileList = a.Files.ToList();
                     return;
                 }
@@ -1437,8 +1436,22 @@ namespace FurnaceUI.Views.Recipes
             {
                 UIGlobalVariable.Instance.ProcessModifiedRecipe[CurrentFileNode.FullPath] = $"Edit {DateTime.Now}";
                 this.editMode = EditMode.Normal;
-                ReloadRecipeFileList(CurrentChamberType, CurrentProcessType, CurrentFileNode.FullPath, false);
-                this.UpdateView();
+                var prefixPath = 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}"}\\{CurrentFileNode.FullPath}");
+                TreeSelectChanged(CurrentFileNode);
+
+                item.FileListByProcessType.ForEachDo(a =>
+                {
+                    a.IsSelected = false;
+                    if (a.FullPath == prefixPath)
+                    {
+                        a.IsSelected = true;
+                        RecipeFileList = a.Files.ToList();
+                        return;
+                    }
+                });
             }
         }
         public void ViewRecipe()

+ 5 - 0
Furnace/FurnaceUI/Views/Recipes/RecipeLayoutView.xaml

@@ -133,6 +133,11 @@
         <Border Background="#DAE5F1" Grid.Column="1">
 
             <ListView       x:Name="RecipeFileList" HorizontalContentAlignment="Stretch" ItemsSource="{Binding RecipeFileList,UpdateSourceTrigger=PropertyChanged}">
+                <ListView.ItemContainerStyle>
+                    <Style BasedOn="{StaticResource ListViewItemBase}" TargetType="{x:Type ListViewItem}">
+                        <Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}"/>
+                    </Style>
+                </ListView.ItemContainerStyle>
                 <ListView.View>
                     <GridView>
                         <GridView.Columns>

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

@@ -187,7 +187,7 @@ namespace FurnaceUI.Views.Recipes
         private List<FileNode> _recipeFileList = new List<FileNode>();
         public List<FileNode> RecipeFileList
         {
-            get { return _recipeFileList != null ? _recipeFileList.OrderByDescending(a => a.ReviseTime).ToList() : _recipeFileList; }
+            get { return _recipeFileList; }
             set { _recipeFileList = value; this.NotifyOfPropertyChange(nameof(RecipeFileList)); }
         }
 
@@ -982,14 +982,13 @@ namespace FurnaceUI.Views.Recipes
             ProcessTypeFileItem item = ProcessTypeFileList.FirstOrDefault(x => x.ProcessType == types[1]);
             item.FileListByProcessType = RecipeSequenceTreeBuilder.GetFileNodeParameterList($"{ChamberType[ChamberTypeIndexSelection]}\\{item.ProcessType}");// RecipeSequenceTreeBuilder.BuildFileNode(prefix, selectedFile, selectionIsFolder, recipes)[0].Files;
             FindSelectedFile(item.FileListByProcessType, $"{$"{ChamberType[ChamberTypeIndexSelection]}\\{item.ProcessType}"}\\{newfile}");
-
+            TreeSelectChanged(CurrentFileNode);
             item.FileListByProcessType.ForEachDo(a =>
             {
                 a.IsSelected = false;
                 if (a.FullPath == prefix)
                 {
                     a.IsSelected = true;
-                    CurrentFileNode = a;
                     RecipeFileList = a.Files.ToList();
                     return;
                 }
@@ -1490,8 +1489,22 @@ namespace FurnaceUI.Views.Recipes
             {
                 UIGlobalVariable.Instance.ProcessModifiedRecipe[CurrentFileNode.FullPath] = $"Edit {DateTime.Now}";
                 this.editMode = EditMode.Normal;
-                ReloadRecipeFileList(CurrentChamberType, CurrentProcessType, CurrentFileNode.FullPath, false);
-                this.UpdateView();
+                var prefixPath = 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}"}\\{CurrentFileNode.FullPath}");
+                TreeSelectChanged(CurrentFileNode);
+
+                item.FileListByProcessType.ForEachDo(a =>
+                {
+                    a.IsSelected = false;
+                    if (a.FullPath == prefixPath)
+                    {
+                        a.IsSelected = true;
+                        RecipeFileList = a.Files.ToList();
+                        return;
+                    }
+                });
             }
         }
         public void ViewRecipe()

+ 6 - 1
Furnace/FurnaceUI/Views/Recipes/RecipeView.xaml

@@ -131,7 +131,7 @@
             </TreeView>
         </Border>
         <Border Background="#DAE5F1" Grid.Column="1">
-
+           
             <ListView       x:Name="RecipeFileList" HorizontalContentAlignment="Stretch" ItemsSource="{Binding RecipeFileList,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
                 <ListView.View>
                     <GridView>
@@ -187,6 +187,11 @@
                         </micro:ActionMessage>
                     </i:EventTrigger>
                 </i:Interaction.Triggers>
+                <ListView.ItemContainerStyle>
+                    <Style BasedOn="{StaticResource ListViewItemBase}" TargetType="{x:Type ListViewItem}">
+                        <Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}"/>
+                    </Style>
+                </ListView.ItemContainerStyle>
             </ListView>
 
         </Border>

+ 4 - 6
Furnace/FurnaceUI/Views/Recipes/RecipeViewModel.cs

@@ -217,7 +217,7 @@ namespace FurnaceUI.Views.Recipes
         private List<FileNode> _recipeFileList = new List<FileNode>();
         public List<FileNode> RecipeFileList
         {
-            get { return _recipeFileList != null ? _recipeFileList.OrderByDescending(a => a.ReviseTime).ToList(): _recipeFileList; }
+            get { return _recipeFileList; }
             set { _recipeFileList = value; this.NotifyOfPropertyChange(nameof(RecipeFileList)); }
         }
 
@@ -1050,14 +1050,13 @@ namespace FurnaceUI.Views.Recipes
             ProcessTypeFileItem item = ProcessTypeFileList.FirstOrDefault(x => x.ProcessType == types[1]);
             item.FileListByProcessType = RecipeSequenceTreeBuilder.GetFileNodeParameterList($"{ChamberType[ChamberTypeIndexSelection]}\\{item.ProcessType}");// RecipeSequenceTreeBuilder.BuildFileNode(prefix, selectedFile, selectionIsFolder, recipes)[0].Files;
             FindSelectedFile(item.FileListByProcessType, $"{$"{ChamberType[ChamberTypeIndexSelection]}\\{item.ProcessType}"}\\{newfile}");
-
+            TreeSelectChanged(CurrentFileNode);
             item.FileListByProcessType.ForEachDo(a =>
             {
                 a.IsSelected = false;
                 if (a.FullPath == prefix)
                 {
                     a.IsSelected = true;
-                    CurrentFileNode = a;
                     RecipeFileList = a.Files.ToList();
                     return;
                 }
@@ -1541,6 +1540,7 @@ namespace FurnaceUI.Views.Recipes
                 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}"}\\{CurrentFileNode.FullPath}");
+                TreeSelectChanged(CurrentFileNode);
 
                 item.FileListByProcessType.ForEachDo(a =>
                 {
@@ -1548,13 +1548,10 @@ namespace FurnaceUI.Views.Recipes
                     if (a.FullPath == prefixPath)
                     {
                         a.IsSelected = true;
-                        CurrentFileNode = a;
                         RecipeFileList = a.Files.ToList();
                         return;
                     }
                 });
-                this.UpdateView();
-
             }
         }
         public void ViewRecipe()
@@ -2216,6 +2213,7 @@ namespace FurnaceUI.Views.Recipes
                 oldName = recipeEditViewModel.CurrentRecipe.Name;
                 oldStepName = recipeEditViewModel.SelectedRecipeStep.Name;
             }
+
             return bret == true;
         }