修正Sequence编辑界面中新增Sequence后,新的Sequence没有出现在左侧文件列表中的问题。
This commit is contained in:
parent
025ff141f5
commit
98b5eebfdd
|
@ -1,5 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using MECF.Framework.Common.CommonData;
|
||||
using MECF.Framework.UI.Client.CenterViews.Editors.Sequence;
|
||||
|
||||
|
@ -20,7 +20,7 @@ namespace MECF.Framework.UI.Client.CenterViews.Editors
|
|||
|
||||
#region Variablers
|
||||
|
||||
private List<FileNode> _filterFileListByProcessType;
|
||||
private ObservableCollection<FileNode> _filterFileListByProcessType;
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -28,8 +28,8 @@ namespace MECF.Framework.UI.Client.CenterViews.Editors
|
|||
|
||||
public ProcessTypeFileItem()
|
||||
{
|
||||
FileListByProcessType = new List<FileNode>();
|
||||
FilterFileListByProcessType = new List<FileNode>();
|
||||
FileListByProcessType = new ObservableCollection<FileNode>();
|
||||
FilterFileListByProcessType = new ObservableCollection<FileNode>();
|
||||
}
|
||||
|
||||
public ProcessTypeFileItem(ProcessFileTypes processType) : this()
|
||||
|
@ -43,9 +43,9 @@ namespace MECF.Framework.UI.Client.CenterViews.Editors
|
|||
|
||||
public string ProcessType { get; set; }
|
||||
|
||||
public List<FileNode> FileListByProcessType { get; set; }
|
||||
public ObservableCollection<FileNode> FileListByProcessType { get; set; }
|
||||
|
||||
public List<FileNode> FilterFileListByProcessType
|
||||
public ObservableCollection<FileNode> FilterFileListByProcessType
|
||||
{
|
||||
get => _filterFileListByProcessType;
|
||||
set
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Windows.Controls;
|
||||
using System.Xml;
|
||||
using Aitex.Core.UI.View.Common;
|
||||
|
@ -9,25 +10,76 @@ namespace MECF.Framework.UI.Client.CenterViews.Editors.Sequence
|
|||
{
|
||||
public class FileNode : PropertyChangedBase
|
||||
{
|
||||
#region Variables
|
||||
|
||||
private string _name = string.Empty;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
public FileNode()
|
||||
{
|
||||
this.Files = new List<FileNode>();
|
||||
this.Files = new ObservableCollection<FileNode>();
|
||||
this.IsFile = false;
|
||||
}
|
||||
|
||||
private string name = string.Empty;
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return name; }
|
||||
set { name = value; NotifyOfPropertyChange("Name"); }
|
||||
get { return _name; }
|
||||
set { _name = value; NotifyOfPropertyChange("Name"); }
|
||||
}
|
||||
public string FullPath { get; set; }
|
||||
|
||||
public FileNode Parent { get; set; }
|
||||
public List<FileNode> Files { get; set; }
|
||||
|
||||
public ObservableCollection<FileNode> Files { get; set; }
|
||||
|
||||
public bool IsFile { get; set; }
|
||||
|
||||
public string PrefixPath { get; set; }
|
||||
|
||||
public bool IsSelected { get; set; }
|
||||
|
||||
public bool IsExpanded { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
/// <summary>
|
||||
/// 将数中的节点转换为节点数组。
|
||||
/// </summary>
|
||||
/// <param name="terminalOnly">是否仅枚举最末端节点。</param>
|
||||
/// <para>更新子节点的Selected属性时,需要同时更新中间节点的属性;更新父节点时,只评估终端节点的Selected属性。</para>
|
||||
/// <returns></returns>
|
||||
private List<FileNode> Flatten(bool terminalOnly)
|
||||
{
|
||||
if (Files == null || Files.Count <= 0)
|
||||
return new List<FileNode>(new[] { this });
|
||||
|
||||
var lst = Files.SelectMany(x => x.Flatten(terminalOnly)).ToList();
|
||||
if (!terminalOnly)
|
||||
lst.Add(this);
|
||||
|
||||
return lst;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 选择指定的节点。
|
||||
/// </summary>
|
||||
/// <param name="fullPath"></param>
|
||||
public void Select(string fullPath)
|
||||
{
|
||||
var flattenList = Flatten(true);
|
||||
flattenList.ForEach(x => { x.IsSelected = x.FullPath == fullPath; });
|
||||
Refresh();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
public class RecipeSequenceTreeBuilder
|
||||
|
|
|
@ -274,7 +274,7 @@ namespace MECF.Framework.UI.Client.CenterViews.Editors.Sequence
|
|||
}
|
||||
}
|
||||
|
||||
public int findInsertPosition(List<FileNode> files)
|
||||
public int findInsertPosition(ObservableCollection<FileNode> files)
|
||||
{
|
||||
var pos = -1;
|
||||
if (files.Count == 0)
|
||||
|
@ -464,6 +464,9 @@ namespace MECF.Framework.UI.Client.CenterViews.Editors.Sequence
|
|||
CurrentFileNode.Files.Insert(findInsertPosition(CurrentFileNode.Files), file);
|
||||
editMode = EditMode.Normal;
|
||||
UpdateView();
|
||||
|
||||
// 自动选中新增节点
|
||||
Files[0].Select(file.FullPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1431,42 +1431,41 @@
|
|||
IsEnabled="{Binding EnableStep}" />
|
||||
|
||||
<materialDesign:Badged
|
||||
x:Name="txtErrorCount"
|
||||
BadgeColorZoneMode="Standard"
|
||||
BadgeBackground="Red"
|
||||
BadgeForeground="White"
|
||||
Margin="30,0,0,0"
|
||||
BadgePlacementMode="TopLeft"
|
||||
CornerRadius="5,5,5,5"
|
||||
materialDesign:BadgedAssist.IsMiniBadge="True" VerticalAlignment="Center">
|
||||
<Button
|
||||
Width="90"
|
||||
Height="30"
|
||||
Content="Validate"
|
||||
IsEnabled="{Binding EnableStep}"
|
||||
micro:Message.Attach="ShowValidationDetailWindow()"/>
|
||||
x:Name="txtErrorCount"
|
||||
BadgeColorZoneMode="Standard"
|
||||
BadgeBackground="Red"
|
||||
BadgeForeground="White"
|
||||
Margin="30,0,0,0"
|
||||
BadgePlacementMode="TopLeft"
|
||||
CornerRadius="5,5,5,5"
|
||||
materialDesign:BadgedAssist.IsMiniBadge="True" VerticalAlignment="Center">
|
||||
<Button
|
||||
Width="90"
|
||||
Height="30"
|
||||
Content="Validate"
|
||||
IsEnabled="{Binding EnableStep}"
|
||||
micro:Message.Attach="ShowValidationDetailWindow()"/>
|
||||
</materialDesign:Badged>
|
||||
|
||||
<materialDesign:Badged
|
||||
x:Name="txtCellAccessPremCount"
|
||||
BadgeColorZoneMode="Standard"
|
||||
BadgeBackground="LimeGreen"
|
||||
BadgeForeground="White"
|
||||
Margin="15,0,0,0"
|
||||
BadgePlacementMode="TopLeft"
|
||||
CornerRadius="5,5,5,5"
|
||||
materialDesign:BadgedAssist.IsMiniBadge="True"
|
||||
VerticalAlignment="Center"
|
||||
Visibility="{Binding IsShowCellAccessPermEditButton, Converter={StaticResource bool2VisibilityConverter}}">
|
||||
x:Name="txtCellAccessPremCount"
|
||||
BadgeColorZoneMode="Standard"
|
||||
BadgeBackground="LimeGreen"
|
||||
BadgeForeground="White"
|
||||
Margin="15,0,0,0"
|
||||
BadgePlacementMode="TopLeft"
|
||||
CornerRadius="5,5,5,5"
|
||||
materialDesign:BadgedAssist.IsMiniBadge="True"
|
||||
VerticalAlignment="Center"
|
||||
Visibility="{Binding IsShowCellAccessPermEditButton, Converter={StaticResource bool2VisibilityConverter}}">
|
||||
<Button
|
||||
Width="100"
|
||||
Height="30"
|
||||
IsEnabled="{Binding EnableCellPermButton}"
|
||||
Content="{Binding IsCellAccessPermissionEditMode, Mode=OneWay, Converter={StaticResource CellPermButtonContent}}"
|
||||
Margin="0,0,0,0"
|
||||
ToolTip="Cell-Access-Perm Edit Mode"
|
||||
micro:Message.Attach="SwitchCellAccessPermEditMode()">
|
||||
</Button>
|
||||
Width="100"
|
||||
Height="30"
|
||||
IsEnabled="{Binding EnableCellPermButton}"
|
||||
Content="{Binding IsCellAccessPermissionEditMode, Mode=OneWay, Converter={StaticResource CellPermButtonContent}}"
|
||||
Margin="0,0,0,0"
|
||||
ToolTip="Cell-Access-Perm Edit Mode"
|
||||
micro:Message.Attach="SwitchCellAccessPermEditMode()"/>
|
||||
</materialDesign:Badged>
|
||||
|
||||
</StackPanel>
|
||||
|
|
|
@ -2432,7 +2432,7 @@ namespace SicUI.Models.RecipeEditors
|
|||
private void ApplyFilter()
|
||||
{
|
||||
ProcessTypeFileList[ProcessTypeIndexSelection].FilterFileListByProcessType =
|
||||
new List<FileNode>(ProcessTypeFileList[ProcessTypeIndexSelection].FileListByProcessType
|
||||
new ObservableCollection<FileNode>(ProcessTypeFileList[ProcessTypeIndexSelection].FileListByProcessType
|
||||
.Where(d => d.Name.IndexOf(CurrentCriteria, StringComparison.OrdinalIgnoreCase) >= 0));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue