LIN Schedule
This commit is contained in:
89
CapMachine.Wpf/ViewModels/LinTreeNodes.cs
Normal file
89
CapMachine.Wpf/ViewModels/LinTreeNodes.cs
Normal file
@@ -0,0 +1,89 @@
|
||||
using Prism.Mvvm;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
namespace CapMachine.Wpf.ViewModels
|
||||
{
|
||||
/// <summary>
|
||||
/// 调度表节点(父节点)。
|
||||
/// 与 XAML 中父级 <TreeView> 的 <HierarchicalDataTemplate> 绑定:
|
||||
/// - 显示字段:<see cref="SchTabName"/>
|
||||
/// - 选择字段:<see cref="IsSelected"/>(TwoWay 绑定至 CheckBox)
|
||||
/// - 子集合:<see cref="Children"/>(用于展开显示消息/帧子节点)
|
||||
///
|
||||
/// 使用 Prism 的 <see cref="BindableBase.SetProperty{T}(ref T, T, string?)"/>
|
||||
/// 以避免值未发生变化时重复触发 PropertyChanged 引起的联动递归。
|
||||
/// </summary>
|
||||
public class LinSchTabNode : BindableBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 调度表名称(父节点标题)。
|
||||
/// </summary>
|
||||
private string _SchTabName;
|
||||
public string SchTabName
|
||||
{
|
||||
get => _SchTabName;
|
||||
set => SetProperty(ref _SchTabName, value);
|
||||
}
|
||||
|
||||
private bool _IsSelected;
|
||||
/// <summary>
|
||||
/// 是否被激活/选中(父节点单选)。
|
||||
/// 该属性与 XAML 中父节点的 CheckBox 进行 TwoWay 绑定,
|
||||
/// 其变更由 ViewModel 监听并处理“单选联动”和“子节点跟随”。
|
||||
/// </summary>
|
||||
public bool IsSelected
|
||||
{
|
||||
get => _IsSelected;
|
||||
set => SetProperty(ref _IsSelected, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 子节点集合(消息/帧条目)。
|
||||
/// </summary>
|
||||
private ObservableCollection<LinMsgNode> _Children = new ObservableCollection<LinMsgNode>();
|
||||
public ObservableCollection<LinMsgNode> Children
|
||||
{
|
||||
get => _Children;
|
||||
set => SetProperty(ref _Children, value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 消息/帧 节点(子节点)。
|
||||
/// 与 XAML 中父级 <HierarchicalDataTemplate.ItemTemplate> 绑定:
|
||||
/// - 显示字段:<see cref="MsgName"/> / <see cref="MsgNameIndex"/>
|
||||
/// - 选择字段:<see cref="IsSelected"/>(当前设计作为“显示联动”,非编辑入口)
|
||||
/// </summary>
|
||||
public class LinMsgNode : BindableBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 消息/帧名称。
|
||||
/// </summary>
|
||||
private string _MsgName;
|
||||
public string MsgName
|
||||
{
|
||||
get => _MsgName;
|
||||
set => SetProperty(ref _MsgName, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 消息/帧 Index。
|
||||
/// </summary>
|
||||
private int _MsgNameIndex;
|
||||
public int MsgNameIndex
|
||||
{
|
||||
get => _MsgNameIndex;
|
||||
set => SetProperty(ref _MsgNameIndex, value);
|
||||
}
|
||||
|
||||
private bool _IsSelected;
|
||||
/// <summary>
|
||||
/// 是否被选中(随父节点联动显示)。
|
||||
/// </summary>
|
||||
public bool IsSelected
|
||||
{
|
||||
get => _IsSelected;
|
||||
set => SetProperty(ref _IsSelected, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user