mirror of
https://gitee.com/langsisi_admin/serein-flow
synced 2026-03-06 09:40:48 +08:00
优化了Workbench上的操作。
This commit is contained in:
46
Workbench/ViewModels/ViewNodeInfoViewModel.cs
Normal file
46
Workbench/ViewModels/ViewNodeInfoViewModel.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using Serein.Library;
|
||||
using Serein.Workbench.Node.View;
|
||||
using Serein.Workbench.Services;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Serein.Workbench.ViewModels
|
||||
{
|
||||
internal partial class ViewNodeInfoViewModel : ObservableObject
|
||||
{
|
||||
private readonly FlowNodeService flowNodeService;
|
||||
|
||||
/// <summary>
|
||||
/// 当前预览的节点
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private NodeModelBase viewNodeModel;
|
||||
|
||||
public ViewNodeInfoViewModel(FlowNodeService flowNodeService)
|
||||
{
|
||||
this.flowNodeService = flowNodeService;
|
||||
InitEvent();
|
||||
}
|
||||
|
||||
private void InitEvent()
|
||||
{
|
||||
flowNodeService.OnViewNodeControlChanged += OnViewNodeControlChanged;
|
||||
}
|
||||
private void OnViewNodeControlChanged(NodeControlBase viewNodeControl)
|
||||
{
|
||||
if(viewNodeControl is null)
|
||||
{
|
||||
ViewNodeModel = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
ViewNodeModel = viewNodeControl.ViewModel.NodeModel;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user