尝试使用源生成器规范NodeModel代码逻辑

This commit is contained in:
fengjiayi
2024-10-20 12:10:57 +08:00
parent 9931fa7436
commit e38833a58c
127 changed files with 5173 additions and 1839 deletions

View File

@@ -1,17 +1,6 @@
using Serein.Library.Api;
using Serein.Library.Attributes;
using Serein.Library.Entity;
using Serein.Library.Utils;
using Serein.NodeFlow;
using Serein.NodeFlow.Tool;
using Serein.Workbench.Node.View;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using Serein.NodeFlow.Env;
using System.Windows;
namespace Serein.Workbench
@@ -34,8 +23,25 @@ namespace Serein.Workbench
/// <param name="window"></param>
public MainWindowViewModel(MainWindow window)
{
FlowEnvironment = new FlowEnvironment();
this.window = window;
UIContextOperation? uIContextOperation = null;
Application.Current.Dispatcher.Invoke(() =>
{
SynchronizationContext? uiContext = SynchronizationContext.Current; // 在UI线程上获取UI线程上下文信息
if (uiContext != null)
{
uIContextOperation = new UIContextOperation(uiContext); // 封装一个调用UI线程的工具类
}
});
if (uIContextOperation is null)
{
throw new Exception("无法封装 UIContextOperation ");
}
else
{
FlowEnvironment = new FlowEnvironmentDecorator(uIContextOperation);
this.window = window;
}
}