mirror of
https://gitee.com/langsisi_admin/serein-flow
synced 2026-03-06 17:50:48 +08:00
解决了接口节点的参数共享,UI控件的Menu菜单事件穿透问题,同时优化了工作台画布流程相关事件的部分代码
This commit is contained in:
@@ -68,10 +68,9 @@ namespace Serein.Workbench.Node.ViewModel
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (targetNodeControl.FlowCanvas is FlowCanvasView view
|
||||
&& view.DataContext is FlowCanvasViewModel viewModel)
|
||||
if (targetNodeControl.FlowCanvas is FlowCanvasView view )
|
||||
{
|
||||
SelectCanvas = viewModel;
|
||||
SelectCanvas = view.ViewModel;
|
||||
SelectNode = targetNodeControl.ViewModel.NodeModel;
|
||||
}
|
||||
}
|
||||
@@ -80,8 +79,10 @@ namespace Serein.Workbench.Node.ViewModel
|
||||
{
|
||||
flowEEForwardingService.OnCanvasCreate += (e) => RershCanvass(); // 画布创建了
|
||||
flowEEForwardingService.OnCanvasRemove += (e) => RershCanvass(); // 画布移除了
|
||||
|
||||
}
|
||||
|
||||
|
||||
partial void OnSelectCanvasChanged(FlowCanvasViewModel value)
|
||||
{
|
||||
FlowCallNode.ResetTargetNode();
|
||||
@@ -89,7 +90,12 @@ namespace Serein.Workbench.Node.ViewModel
|
||||
|
||||
partial void OnSelectNodeChanged(NodeModelBase value)
|
||||
{
|
||||
FlowCallNode.SetTargetNode(value);
|
||||
if(value is null)
|
||||
{
|
||||
FlowCallNode.ResetTargetNode();
|
||||
return;
|
||||
}
|
||||
FlowCallNode.SetTargetNode(value.Guid);
|
||||
}
|
||||
|
||||
private void RershCanvass()
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Serein.Library;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using Serein.Library;
|
||||
using Serein.Library.Api;
|
||||
using Serein.NodeFlow.Model;
|
||||
using System;
|
||||
@@ -10,17 +11,24 @@ using System.Windows.Controls;
|
||||
|
||||
namespace Serein.Workbench.Node.ViewModel
|
||||
{
|
||||
public class UINodeControlViewModel : NodeControlViewModelBase
|
||||
public partial class UINodeControlViewModel : NodeControlViewModelBase
|
||||
{
|
||||
private SingleUINode NodeModel => (SingleUINode)base.NodeModel;
|
||||
//public IEmbeddedContent Adapter => NodeModel.Adapter;
|
||||
|
||||
/// <summary>
|
||||
/// 节点UI的对应内容
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private UserControl _nodeUIContent;
|
||||
|
||||
|
||||
public UINodeControlViewModel(NodeModelBase nodeModel) : base(nodeModel)
|
||||
{
|
||||
//NodeModel.Adapter.GetWindowHandle();
|
||||
|
||||
}
|
||||
|
||||
public void InitAdapter(Action<UserControl> setUIDisplayHandle)
|
||||
public void InitAdapter()
|
||||
{
|
||||
Task.Factory.StartNew(async () =>
|
||||
{
|
||||
@@ -32,11 +40,32 @@ namespace Serein.Workbench.Node.ViewModel
|
||||
&& NodeModel.Adapter.GetUserControl() is UserControl userControl)
|
||||
{
|
||||
NodeModel.Env.UIContextOperation.Invoke(() =>
|
||||
{
|
||||
NodeUIContent = userControl;
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public void InitAdapter(Action<UserControl> setUIDisplayHandle)
|
||||
{
|
||||
Task.Factory.StartNew(async () =>
|
||||
{
|
||||
var context = new DynamicContext(NodeModel.Env);
|
||||
var cts = new CancellationTokenSource();
|
||||
var result = await NodeModel.ExecutingAsync(context, cts.Token);
|
||||
cts?.Dispose();
|
||||
if (context.NextOrientation == ConnectionInvokeType.IsSucceed
|
||||
&& NodeModel.Adapter.GetUserControl() is UserControl userControl)
|
||||
{
|
||||
NodeModel.Env.UIContextOperation.Invoke(() =>
|
||||
{
|
||||
setUIDisplayHandle.Invoke(userControl);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user