using Prism.Mvvm;
using System.Collections.ObjectModel;
namespace CapMachine.Wpf.ViewModels
{
///
/// 调度表节点(父节点)。
/// 与 XAML 中父级 的 绑定:
/// - 显示字段:
/// - 选择字段:(TwoWay 绑定至 CheckBox)
/// - 子集合:(用于展开显示消息/帧子节点)
///
/// 使用 Prism 的
/// 以避免值未发生变化时重复触发 PropertyChanged 引起的联动递归。
///
public class LinSchTabNode : BindableBase
{
///
/// 调度表名称(父节点标题)。
///
private string _SchTabName;
public string SchTabName
{
get => _SchTabName;
set => SetProperty(ref _SchTabName, value);
}
private bool _IsSelected;
///
/// 是否被激活/选中(父节点单选)。
/// 该属性与 XAML 中父节点的 CheckBox 进行 TwoWay 绑定,
/// 其变更由 ViewModel 监听并处理“单选联动”和“子节点跟随”。
///
public bool IsSelected
{
get => _IsSelected;
set => SetProperty(ref _IsSelected, value);
}
///
/// 子节点集合(消息/帧条目)。
///
private ObservableCollection _Children = new ObservableCollection();
public ObservableCollection Children
{
get => _Children;
set => SetProperty(ref _Children, value);
}
}
///
/// 消息/帧 节点(子节点)。
/// 与 XAML 中父级 绑定:
/// - 显示字段: /
/// - 选择字段:(当前设计作为“显示联动”,非编辑入口)
///
public class LinMsgNode : BindableBase
{
///
/// 所属的调度表名称(便于回写 DTO 时定位)。
///
private string _SchTabName;
public string SchTabName
{
get => _SchTabName;
set => SetProperty(ref _SchTabName, value);
}
///
/// 消息/帧名称。
///
private string _MsgName;
public string MsgName
{
get => _MsgName;
set => SetProperty(ref _MsgName, value);
}
///
/// 消息/帧 Index。
///
private int _MsgNameIndex;
public int MsgNameIndex
{
get => _MsgNameIndex;
set => SetProperty(ref _MsgNameIndex, value);
}
private bool _IsSelected;
///
/// 是否被选中(随父节点联动显示)。
///
public bool IsSelected
{
get => _IsSelected;
set => SetProperty(ref _IsSelected, value);
}
///
/// 子节点勾选是否可用(仅当父调度表被选中时可编辑)。
///
private bool _CanEdit;
public bool CanEdit
{
get => _CanEdit;
set => SetProperty(ref _CanEdit, value);
}
}
}