using Serein.NodeFlow.Model;
using Serein.NodeFlow.Model.Nodes;
using System.Windows;
using System.Windows.Input;
namespace Serein.Workbench.Node.ViewModel
{
///
/// 全局数据节点控制视图模型
///
public class GlobalDataNodeControlViewModel : NodeControlViewModelBase
{
private new SingleGlobalDataNode NodeModel => (SingleGlobalDataNode)base.NodeModel;
///
/// 复制全局数据表达式
///
public ICommand CommandCopyDataExp { get; }
///
/// 刷新数据
///
public ICommand CommandRefreshData { get; }
///
/// 全局数据节点控制视图模型构造函数
///
///
public GlobalDataNodeControlViewModel(SingleGlobalDataNode node) : base(node)
{
CommandCopyDataExp = new RelayCommand( o =>
{
string exp = NodeModel.KeyName;
string copyValue = $"@Get #{exp}#";
Clipboard.SetDataObject(copyValue);
});
}
///
/// 自定义参数值
///
public string? KeyName
{
get => NodeModel?.KeyName;
set { NodeModel.KeyName = value; OnPropertyChanged(); }
}
}
}