diff --git a/Serein.Workbench.Avalonia/Api/IFlowEEForwardingService.cs b/Serein.Workbench.Avalonia/Api/IFlowEEForwardingService.cs
deleted file mode 100644
index e47db79..0000000
--- a/Serein.Workbench.Avalonia/Api/IFlowEEForwardingService.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-using Serein.Library.Api;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Serein.Workbench.Avalonia.Api
-{
- ///
- /// 流程事件管理,转发流程运行环境中触发的事件到工作台各个订阅者
- ///
- internal interface IFlowEEForwardingService : IFlowEnvironmentEvent
- {
-
- }
-}
diff --git a/Serein.Workbench.Avalonia/Api/INodeContainerControl.cs b/Serein.Workbench.Avalonia/Api/INodeContainerControl.cs
deleted file mode 100644
index b826be2..0000000
--- a/Serein.Workbench.Avalonia/Api/INodeContainerControl.cs
+++ /dev/null
@@ -1,32 +0,0 @@
-using Serein.Workbench.Avalonia.Custom.Node.Views;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Serein.Workbench.Avalonia.Api
-{
- ///
- /// 约束具有容器功能的节点控件应该有什么方法
- ///
- public interface INodeContainerControl
- {
- ///
- /// 放置一个节点
- ///
- ///
- bool PlaceNode(NodeControlBase nodeControl);
-
- ///
- /// 取出一个节点
- ///
- ///
- bool TakeOutNode(NodeControlBase nodeControl);
-
- ///
- /// 取出所有节点(用于删除容器)
- ///
- void TakeOutAll();
- }
-}
diff --git a/Serein.Workbench.Avalonia/Api/INodeControl.cs b/Serein.Workbench.Avalonia/Api/INodeControl.cs
deleted file mode 100644
index 06770d2..0000000
--- a/Serein.Workbench.Avalonia/Api/INodeControl.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-using Serein.Library;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Serein.Workbench.Avalonia.Api
-{
- //internal interface INodeControl
- //{
- // ///
- // /// 对应的节点实体
- // ///
- // NodeModelBase NodeModelBase { get; }
-
- // ///
- // /// 初始化使用的方法,设置节点实体
- // ///
- // ///
- // void SetNodeModel(NodeModelBase nodeModel);
- //}
-}
diff --git a/Serein.Workbench.Avalonia/Api/INodeJunction.cs b/Serein.Workbench.Avalonia/Api/INodeJunction.cs
deleted file mode 100644
index 9423def..0000000
--- a/Serein.Workbench.Avalonia/Api/INodeJunction.cs
+++ /dev/null
@@ -1,52 +0,0 @@
-using Serein.Library;
-using Serein.Workbench.Avalonia.Custom.Views;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Serein.Workbench.Avalonia.Api
-{
-
-
-
- ///
- /// 约束一个节点应该有哪些控制点
- ///
- public interface INodeJunction
- {
- ///
- /// 方法执行入口控制点
- ///
- NodeJunctionView ExecuteJunction { get; }
- ///
- /// 执行完成后下一个要执行的方法控制点
- ///
- NodeJunctionView NextStepJunction { get; }
-
- ///
- /// 参数节点控制点
- ///
- NodeJunctionView[] ArgDataJunction { get; }
- ///
- /// 返回值控制点
- ///
- NodeJunctionView ReturnDataJunction { get; }
-
- ///
- /// 获取目标参数控制点,用于防止wpf释放资源导致找不到目标节点,返回-1,-1的坐标
- ///
- ///
- ///
- NodeJunctionView GetJunctionOfArgData(int index)
- {
- var arr = ArgDataJunction;
- if (index >= arr.Length)
- {
- return null;
- }
- return arr[index];
- }
- }
-}
diff --git a/Serein.Workbench.Avalonia/App.axaml b/Serein.Workbench.Avalonia/App.axaml
deleted file mode 100644
index 266d3be..0000000
--- a/Serein.Workbench.Avalonia/App.axaml
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/Serein.Workbench.Avalonia/App.axaml.cs b/Serein.Workbench.Avalonia/App.axaml.cs
deleted file mode 100644
index 5cf29aa..0000000
--- a/Serein.Workbench.Avalonia/App.axaml.cs
+++ /dev/null
@@ -1,140 +0,0 @@
-using Avalonia;
-using Avalonia.Controls.ApplicationLifetimes;
-using Avalonia.Data.Core.Plugins;
-using Avalonia.Markup.Xaml;
-using Avalonia.Threading;
-using Microsoft.Extensions.DependencyInjection;
-using Serein.Library;
-using Serein.Library.Api;
-using Serein.Library.Utils;
-using Serein.NodeFlow;
-using Serein.NodeFlow.Env;
-using Serein.Workbench.Avalonia.Api;
-using Serein.Workbench.Avalonia.Custom.Node.ViewModels;
-using Serein.Workbench.Avalonia.Custom.Node.Views;
-using Serein.Workbench.Avalonia.Custom.ViewModels;
-using Serein.Workbench.Avalonia.Services;
-using Serein.Workbench.Avalonia.ViewModels;
-using Serein.Workbench.Avalonia.Views;
-using System;
-using System.Threading;
-using System.Threading.Tasks;
-
-namespace Serein.Workbench.Avalonia;
-
-public static class ServiceCollectionExtensions
-{
- ///
- /// 注册ViewModel
- ///
- ///
- public static void AddViewModelServices(this IServiceCollection collection)
- {
- collection.AddTransient(); // 主窗体
- collection.AddTransient(); // 主窗体菜单
- collection.AddTransient(); // 依赖集合
- collection.AddTransient(); // 预览的方法信息
- //collection.AddTransient(); // 节点参数信息
- collection.AddTransient(); // 节点容器(画布)
-
-
- collection.AddTransient(); // 节点容器(画布)
-
-
- //collection.AddTransient(); // 依赖信息
- }
-
- public static void AddWorkbenchServices(this IServiceCollection collection)
- {
- collection.AddSingleton(); // 流程事件管理
- collection.AddSingleton(); // 流程事件管理
- collection.AddSingleton(); // 节点操作管理
- collection.AddSingleton(); // 按键事件管理
- //collection.AddSingleton(); // 流程节点控件管理
- }
-
-
- ///
- /// 注册流程接口相关实例
- ///
- ///
- public static void AddFlowServices(this IServiceCollection collection)
- {
-
- #region 创建实例
- Func getSyncContext = null;
- Dispatcher.UIThread.Invoke(() =>
- {
- var uiContext = SynchronizationContext.Current; // 在UI线程上获取UI线程上下文信息
- if(uiContext is not null)
- {
- getSyncContext = () => uiContext;
- }
- });
-
- UIContextOperation? uIContextOperation = null;
- uIContextOperation = new UIContextOperation(getSyncContext); // 封装一个调用UI线程的工具类
- var flowEnvironmentDecorator = new FlowEnvironmentDecorator();
- flowEnvironmentDecorator.SetUIContextOperation(uIContextOperation);
- collection.AddSingleton(uIContextOperation); // 注册UI线程操作上下文
- collection.AddSingleton(flowEnvironmentDecorator); // 注册运行环境
- collection.AddSingleton(flowEnvironmentDecorator); // 注册运行环境事件
- //var strte = tcs.Task.ConfigureAwait(false).GetAwaiter().GetResult();
- //if (strte) // 等待实例生成完成
- //{
- //}
- #endregion
-
- }
-}
-
-
-public partial class App : Application
-{
- private static IServiceProvider? ServiceProvider;
- public static T GetService() where T : class
- {
- return ServiceProvider?.GetService() ?? throw new NullReferenceException();
- }
-
- public override void Initialize()
- {
- AvaloniaXamlLoader.Load(this);
- }
-
-
- public override async void OnFrameworkInitializationCompleted()
- {
- // 如果使用 CommunityToolkit,则需要用下面一行移除 Avalonia 数据验证。
- // 如果没有这一行,数据验证将会在 Avalonia 和 CommunityToolkit 中重复。
- BindingPlugins.DataValidators.RemoveAt(0);
-
- // 注册应用程序运行所需的所有服务
- var collection = new ServiceCollection();
- collection.AddWorkbenchServices();
- collection.AddFlowServices();
- collection.AddViewModelServices();
- var services = collection.BuildServiceProvider(); // 绑定并返回获取实例的服务接口
- App.ServiceProvider = services;
-
-
- var vm = App.ServiceProvider?.GetRequiredService();
- if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
- {
- desktop.MainWindow = new MainWindow
- {
- DataContext = vm
- };
- }
- else if (ApplicationLifetime is ISingleViewApplicationLifetime singleViewPlatform)
- {
- singleViewPlatform.MainView = new MainView
- {
- DataContext = vm
- };
- }
-
- base.OnFrameworkInitializationCompleted();
- }
-
-}
diff --git a/Serein.Workbench.Avalonia/Assets/avalonia-logo.ico b/Serein.Workbench.Avalonia/Assets/avalonia-logo.ico
deleted file mode 100644
index da8d49f..0000000
Binary files a/Serein.Workbench.Avalonia/Assets/avalonia-logo.ico and /dev/null differ
diff --git a/Serein.Workbench.Avalonia/Commands/CommandBase.cs b/Serein.Workbench.Avalonia/Commands/CommandBase.cs
deleted file mode 100644
index b34fe48..0000000
--- a/Serein.Workbench.Avalonia/Commands/CommandBase.cs
+++ /dev/null
@@ -1,38 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Serein.Workbench.Avalonia.Commands
-{
- internal abstract class CommandBase
- {
- // CanExecuteChanged 事件
- public event EventHandler CanExecuteChanged;
-
- ///
- /// 是否可以执行命令,子类可以重写这个方法来提供具体的可执行条件
- ///
- ///
- ///
- public virtual bool CanExecute(object parameter)
- {
- return true; // 默认实现返回 true,表示命令可以执行
- }
-
- ///
- /// 执行命令,子类可以重写这个方法来实现具体的命令逻辑
- ///
- ///
- public abstract void Execute(object parameter);
-
- ///
- /// 用于触发 CanExecuteChanged 事件
- ///
- protected void OnCanExecuteChanged()
- {
- CanExecuteChanged?.Invoke(this, EventArgs.Empty);
- }
- }
-}
diff --git a/Serein.Workbench.Avalonia/Commands/MyCommand.cs b/Serein.Workbench.Avalonia/Commands/MyCommand.cs
deleted file mode 100644
index 6ec85f9..0000000
--- a/Serein.Workbench.Avalonia/Commands/MyCommand.cs
+++ /dev/null
@@ -1,48 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Serein.Workbench.Avalonia.Commands
-{
- ///
- /// 流程控制命令
- ///
- internal class MyCommand : CommandBase
- {
- private readonly Action _execute;
- private readonly Func _canExecute;
-
- ///
- /// 构造函数接收执行动作和是否可执行的条件
- ///
- ///
- ///
- ///
- public MyCommand(Action execute, Func canExecute = null)
- {
- _execute = execute ?? throw new ArgumentNullException(nameof(execute));
- _canExecute = canExecute;
- }
-
- ///
- /// 重写 CanExecute 方法,基于 _canExecute 委托的结果来判断命令是否可执行
- ///
- ///
- ///
- public override bool CanExecute(object parameter)
- {
- return _canExecute?.Invoke() ?? true;
- }
-
- ///
- /// 重写 Execute 方法,执行具体的命令逻辑
- ///
- ///
- public override void Execute(object parameter)
- {
- _execute();
- }
- }
-}
diff --git a/Serein.Workbench.Avalonia/Controls/DragControls.cs b/Serein.Workbench.Avalonia/Controls/DragControls.cs
deleted file mode 100644
index 0221a3b..0000000
--- a/Serein.Workbench.Avalonia/Controls/DragControls.cs
+++ /dev/null
@@ -1,127 +0,0 @@
-using Avalonia.Controls;
-using Avalonia.Input;
-using Avalonia.Markup.Xaml;
-using Avalonia.Threading;
-using Avalonia;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using Avalonia.VisualTree;
-
-namespace Serein.Workbench.Avalonia.Controls
-{
- ///
- /// 实现拖动的控件
- ///
- public partial class DragControls : UserControl
- {
- ///
- /// 记录上一次鼠标位置
- ///
- private Point lastMousePosition;
-
- ///
- /// 用于平滑更新坐标的计时器
- ///
- private DispatcherTimer _timer;
-
- ///
- /// 标记是否先启动了拖动
- ///
- private bool isDragging = false;
-
- ///
- /// 需要更新的坐标点
- ///
- private PixelPoint _targetPosition;
-
- public DragControls()
- {
- InitializeComponent();
-
- // 添加当前控件的事件监听
- PointerPressed += OnPointerPressed;
- PointerMoved += OnPointerMoved;
- PointerReleased += OnPointerReleased;
-
- // 初始化计时器
- _timer = new DispatcherTimer
- {
-
-
- Interval = TimeSpan.FromMilliseconds(10)
- };
- _timer.Tick += OnTimerTick;
- }
-
- ///
- /// 计时器事件
- ///
- ///
- ///
- private void OnTimerTick(object sender, EventArgs e)
- {
-
-
- var window = this.FindAncestorOfType();
- if (window != null && window.Position != _targetPosition)
- {
-
-
- // 更新坐标
- window.Position = _targetPosition;
- }
- }
-
- private void InitializeComponent()
- {
- AvaloniaXamlLoader.Load(this);
- }
-
- private void OnPointerPressed(object sender, PointerPressedEventArgs e)
- {
-
-
- if (!e.GetCurrentPoint(this).Properties.IsLeftButtonPressed) return;
- // 启动拖动
- isDragging = true;
- // 记录当前坐标
- lastMousePosition = e.GetPosition(this);
- e.Handled = true;
- // 启动计时器
- _timer.Start();
- }
-
- private void OnPointerReleased(object sender, PointerReleasedEventArgs e)
- {
-
-
- if (!isDragging) return;
- // 停止拖动
- isDragging = false;
- e.Handled = true;
- // 停止计时器
- _timer.Stop();
- }
-
- private void OnPointerMoved(object sender, PointerEventArgs e)
- {
- if (!e.GetCurrentPoint(this).Properties.IsLeftButtonPressed) return;
-
- // 如果没有启动拖动,则不执行
- if (!isDragging) return;
-
- var currentMousePosition = e.GetPosition(this);
- var offset = currentMousePosition - lastMousePosition;
- var window = this.FindAncestorOfType();
- if (window != null)
- {
- // 记录当前坐标
- _targetPosition = new PixelPoint(window.Position.X + (int)offset.X,
- window.Position.Y + (int)offset.Y);
- }
- }
- }
-}
diff --git a/Serein.Workbench.Avalonia/Converters/BoolToBrushConverter .cs b/Serein.Workbench.Avalonia/Converters/BoolToBrushConverter .cs
deleted file mode 100644
index 0011f90..0000000
--- a/Serein.Workbench.Avalonia/Converters/BoolToBrushConverter .cs
+++ /dev/null
@@ -1,31 +0,0 @@
-using Avalonia.Data.Converters;
-using Avalonia.Media;
-using System;
-using System.Collections.Generic;
-using System.Globalization;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Serein.Workbench.Avalonia.Converters
-{
- public class BoolToBrushConverter : IValueConverter
- {
- public IBrush TrueBrush { get; set; } = Brushes.LightBlue;
- public IBrush FalseBrush { get; set; } = Brushes.Transparent;
-
- public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
- {
- if (value is bool boolValue)
- {
- return boolValue ? TrueBrush : FalseBrush;
- }
- return FalseBrush;
- }
-
- public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
- {
- return false;
- }
- }
-}
diff --git a/Serein.Workbench.Avalonia/Converters/IsVisibleOfParameterConverter.cs b/Serein.Workbench.Avalonia/Converters/IsVisibleOfParameterConverter.cs
deleted file mode 100644
index 47d20a8..0000000
--- a/Serein.Workbench.Avalonia/Converters/IsVisibleOfParameterConverter.cs
+++ /dev/null
@@ -1,42 +0,0 @@
-using Avalonia.Data;
-using Avalonia.Data.Converters;
-using Serein.Library;
-using System;
-using System.Collections.Generic;
-using System.Globalization;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Serein.Workbench.Avalonia.Converters
-{
- internal class IsVisibleOfParameterConverter : IValueConverter
- {
- public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
- {
-
- if(value is ParameterDetails pd)
- {
-
- if (pd.InputType == ParameterValueInputType.Input)
- {
-
- return false;
-
- }
- else
- {
- return true;
- }
- }
-
- // converter used for the wrong type
- return new BindingNotification(new InvalidCastException(), BindingErrorType.Error);
- }
-
- public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
- {
- throw new NotImplementedException();
- }
- }
-}
diff --git a/Serein.Workbench.Avalonia/Custom/Junction/JunctionControlBase.cs b/Serein.Workbench.Avalonia/Custom/Junction/JunctionControlBase.cs
deleted file mode 100644
index 8f61ad5..0000000
--- a/Serein.Workbench.Avalonia/Custom/Junction/JunctionControlBase.cs
+++ /dev/null
@@ -1,245 +0,0 @@
-using Avalonia.Controls.Shapes;
-using Avalonia.Controls;
-using Avalonia.Media;
-using Serein.Workbench.Avalonia.Views;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using Avalonia;
-using Avalonia.VisualTree;
-using Serein.Library;
-
-namespace Serein.Workbench.Avalonia.Custom.Junction
-{
- public abstract class JunctionControlBase : Control
- {
- protected JunctionControlBase()
- {
- this.Width = 25;
- this.Height = 20;
- this.PointerPressed += JunctionControlBase_PointerPressed;
- this.PointerMoved += JunctionControlBase_PointerMoved;
- this.PointerExited += JunctionControlBase_PointerExited;
- }
-
-/*
- #region 控件属性,所在的节点
- public static readonly DependencyProperty NodeProperty =
- DependencyProperty.Register(nameof(MyNode), typeof(NodeModelBase), typeof(JunctionControlBase), new PropertyMetadata(default(NodeModelBase)));
-
- //public NodeModelBase NodeModel;
-
- ///
- /// 所在的节点
- ///
- public NodeModelBase MyNode
- {
- get { return (NodeModelBase)GetValue(NodeProperty); }
- set { SetValue(NodeProperty, value); }
- }
- #endregion
-
- #region 控件属性,连接器类型
- public static readonly DependencyProperty JunctionTypeProperty =
- DependencyProperty.Register(nameof(JunctionType), typeof(string), typeof(JunctionControlBase), new PropertyMetadata(default(string)));
-
- ///
- /// 控制点类型
- ///
- public JunctionType JunctionType
- {
- get { return EnumHelper.ConvertEnum(GetValue(JunctionTypeProperty).ToString()); }
- set { SetValue(JunctionTypeProperty, value.ToString()); }
- }
- #endregion
- protected override Geometry DefiningGeometry => StreamGeometry;
-*/
- protected readonly StreamGeometry StreamGeometry = new StreamGeometry();
-
- ///
- /// 重绘方法
- ///
- ///
- public abstract void OnRender(DrawingContext drawingContext);
- ///
- /// 中心点
- ///
- public abstract Point MyCenterPoint { get; }
-
-
-
- ///
- /// 禁止连接
- ///
- private bool IsConnectionDisable;
-
- ///
- /// 处理鼠标悬停状态
- ///
- private bool _isMouseOver;
- public bool IsMouseOver
- {
- get => _isMouseOver;
- set
- {
- if (_isMouseOver != value)
- {
- //GlobalJunctionData.MyGlobalConnectingData.CurrentJunction = this;
- _isMouseOver = value;
- InvalidateVisual();
- }
-
- }
- }
-
- ///
- /// 控件重绘事件
- ///
- ///
- public override void Render(DrawingContext drawingContext)
- {
- OnRender(drawingContext);
- }
-
- ///
- /// 获取背景颜色
- ///
- ///
- protected Brush GetBackgrounp()
- {
- return (Brush)Brushes.Transparent;
- //var myData = GlobalJunctionData.MyGlobalConnectingData;
- //if (!myData.IsCreateing)
- //{
- // return Brushes.Transparent;
- //}
- //if (IsMouseOver)
- //{
- // if (myData.IsCanConnected)
- // {
- // if (myData.Type == JunctionOfConnectionType.Invoke)
- // {
- // return myData.ConnectionInvokeType.ToLineColor();
- // }
- // else
- // {
- // return myData.ConnectionArgSourceType.ToLineColor();
- // }
- // }
- // else
- // {
- // return Brushes.Red;
- // }
- //}
- //else
- //{
- // return Brushes.Transparent;
- //}
- }
-
- private object lockObj = new object();
-
-
- ///
- /// 控件获得鼠标焦点事件
- ///
- ///
- ///
- private void JunctionControlBase_PointerMoved(object? sender, global::Avalonia.Input.PointerEventArgs e)
- {
- //if (!GlobalJunctionData.MyGlobalConnectingData.IsCreateing) return;
-
- //if (IsMouseOver) return;
- IsMouseOver = true;
-
- this.InvalidateVisual();
- }
-
- ///
- /// 控件失去鼠标焦点事件
- ///
- ///
- ///
- private void JunctionControlBase_PointerExited(object? sender, global::Avalonia.Input.PointerEventArgs e)
- {
- IsMouseOver = false;
- e.Handled = true;
-
- }
-
- ///
- /// 在碰撞点上按下鼠标控件开始进行移动
- ///
- ///
- ///
- private void JunctionControlBase_PointerPressed(object? sender, global::Avalonia.Input.PointerPressedEventArgs e)
- {
- throw new NotImplementedException();
- //if (e.LeftButton == MouseButtonState.Pressed)
- //{
- // var canvas = MainWindow.GetParentOfType