重新优化了NodeModel类;从硬编码类型改为“注册/获取”的方式,为下一步解耦Workbench与节点UI做准备。

新增了“全局数据节点”;保存项目文件时,不同节点可以使用自定义数据保存自身独特的数据,不再借用“方法参数”。
重新设计了运行时的环境输出;增量式生成器现在可以选择在属性变更的前后时间点插入自定义代码;重写了加载项目、保存项目的方法。
This commit is contained in:
fengjiayi
2024-12-12 20:31:50 +08:00
parent dbbaa10cc0
commit 49603bb58f
40 changed files with 999 additions and 681 deletions

View File

@@ -1,18 +1,61 @@
using Serein.NodeFlow.Model;
using Serein.Library;
using Serein.NodeFlow.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
namespace Serein.Workbench.Node.ViewModel
{
public class GlobalDataNodeControlViewModel : NodeControlViewModelBase
{
public new SingleGlobalDataNode NodelModel { get; }
private SingleGlobalDataNode NodeModel => (SingleGlobalDataNode)base.NodeModel;
/// <summary>
/// 复制全局数据表达式
/// </summary>
public ICommand CommandCopyDataExp { get; }
/// <summary>
/// 刷新数据
/// </summary>
public ICommand CommandRefreshData { get; }
public GlobalDataNodeControlViewModel(SingleGlobalDataNode node) : base(node)
{
this.NodelModel = node;
CommandCopyDataExp = new RelayCommand( o =>
{
string exp = NodeModel.KeyName;
string copyValue = "@Data " + exp;
Clipboard.SetDataObject(copyValue);
});
}
/// <summary>
/// 自定义参数值
/// </summary>
public string? KeyName
{
get => NodeModel?.KeyName;
set { NodeModel.KeyName = value; OnPropertyChanged(); }
}
/// <summary>
/// 设置数据节点
/// </summary>
/// <param name="dataNode"></param>
public void SetDataNode(NodeModelBase dataNode)
{
NodeModel.SetDataNode(dataNode);
}
}
}