2025-05-30 23:31:31 +08:00
|
|
|
|
using CommunityToolkit.Mvvm.ComponentModel;
|
|
|
|
|
|
using Serein.Library;
|
2025-05-31 12:15:01 +08:00
|
|
|
|
using Serein.Library.Api;
|
2025-05-30 23:31:31 +08:00
|
|
|
|
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]
|
2025-05-31 12:15:01 +08:00
|
|
|
|
private IFlowNode viewNodeModel;
|
2025-05-30 23:31:31 +08:00
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|