重构了底层,方便向Android、Web、Linux进行跨平台迁移

This commit is contained in:
fengjiayi
2024-09-15 12:15:32 +08:00
parent 0271825fa9
commit 19247b5afe
51 changed files with 4987 additions and 1526 deletions

View File

@@ -1,4 +1,5 @@
using Serein.NodeFlow.Model;
using Serein.NodeFlow;
using Serein.NodeFlow.Model;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
@@ -107,8 +108,19 @@ namespace Serein.WorkBench.Node.View
{
if (sender is TextBlock typeText)
{
var dragData = new DataObject(MouseNodeType.RegionType, typeText.Tag);
MoveNodeData moveNodeData = new MoveNodeData
{
NodeControlType = Library.Enums.NodeControlType.ConditionRegion
};
// 创建一个 DataObject 用于拖拽操作,并设置拖拽效果
DataObject dragData = new DataObject(MouseNodeType.CreateDllNodeInCanvas, moveNodeData);
DragDrop.DoDragDrop(typeText, dragData, DragDropEffects.Move);
//var dragData = new DataObject(MouseNodeType.CreateNodeInCanvas, typeText.Tag);
//DragDrop.DoDragDrop(typeText, dragData, DragDropEffects.Move);
}
}
}

View File

@@ -1,5 +1,8 @@
using Serein.NodeFlow;
using Serein.Library.Entity;
using Serein.Library.Enums;
using Serein.NodeFlow;
using System.Windows;
using System.Windows.Automation;
using System.Windows.Controls;
using System.Windows.Input;
@@ -115,12 +118,26 @@ namespace Serein.WorkBench.Node.View
{
// 获取触发事件的 TextBlock
TextBlock typeText = sender as TextBlock;
if (typeText != null)
if (sender is TextBlock typeText && typeText.Tag is MethodDetails md)
{
MoveNodeData moveNodeData = new MoveNodeData
{
NodeControlType = md.MethodDynamicType switch
{
NodeType.Action => NodeControlType.Action,
NodeType.Flipflop => NodeControlType.Flipflop,
_ => NodeControlType.None,
},
MethodDetails = md,
};
if(moveNodeData.NodeControlType == NodeControlType.None)
{
return;
}
// 创建一个 DataObject 用于拖拽操作,并设置拖拽效果
DataObject dragData = new DataObject(MouseNodeType.DllNodeType, typeText.Tag);
DataObject dragData = new DataObject(MouseNodeType.CreateDllNodeInCanvas, moveNodeData);
DragDrop.DoDragDrop(typeText, dragData, DragDropEffects.Move);
}
}

View File

@@ -1,5 +1,6 @@
using Serein.NodeFlow;
using Serein.NodeFlow.Model;
using Serein.Library.Api;
using Serein.Library.Entity;
using Serein.NodeFlow.Base;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;
@@ -34,7 +35,7 @@ namespace Serein.WorkBench.Node.View
public abstract class NodeControlViewModelBase : INotifyPropertyChanged
{
public NodeControlViewModelBase(NodeBase node)
public NodeControlViewModelBase(NodeModelBase node)
{
this.Node = node;
MethodDetails = this.Node.MethodDetails;
@@ -43,7 +44,7 @@ namespace Serein.WorkBench.Node.View
/// <summary>
/// 对应的节点实体类
/// </summary>
public NodeBase Node { get; set; }
public NodeModelBase Node { get; }
/// <summary>
/// 表示节点控件是否被选中
@@ -63,13 +64,7 @@ namespace Serein.WorkBench.Node.View
}
}
public event PropertyChangedEventHandler PropertyChanged;
protected void OnPropertyChanged([CallerMemberName] string propertyName = null)
{