2024-09-15 12:15:32 +08:00
|
|
|
|
using Serein.Library.Api;
|
|
|
|
|
|
using Serein.Library.Entity;
|
|
|
|
|
|
using Serein.NodeFlow.Base;
|
2024-08-05 10:11:58 +08:00
|
|
|
|
using System.Collections.ObjectModel;
|
|
|
|
|
|
using System.Collections.Specialized;
|
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
|
using System.Runtime.CompilerServices;
|
|
|
|
|
|
using System.Windows.Controls;
|
|
|
|
|
|
using System.Windows.Media;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Serein.WorkBench.Node.View
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 节点控件基类(控件)
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public abstract class NodeControlBase : UserControl, IDynamicFlowNode
|
|
|
|
|
|
{
|
2024-09-12 20:32:54 +08:00
|
|
|
|
public NodeControlViewModelBase ViewModel { get; set; }
|
|
|
|
|
|
|
2024-08-05 19:43:57 +08:00
|
|
|
|
|
2024-08-05 10:11:58 +08:00
|
|
|
|
protected NodeControlBase()
|
2024-08-05 19:43:57 +08:00
|
|
|
|
|
2024-08-05 10:11:58 +08:00
|
|
|
|
{
|
|
|
|
|
|
this.Background = Brushes.Transparent;
|
|
|
|
|
|
}
|
2024-09-12 20:32:54 +08:00
|
|
|
|
protected NodeControlBase(NodeControlViewModelBase viewModelBase)
|
2024-08-05 10:11:58 +08:00
|
|
|
|
{
|
2024-09-12 20:32:54 +08:00
|
|
|
|
ViewModel = viewModelBase;
|
2024-08-05 19:43:57 +08:00
|
|
|
|
this.Background = Brushes.Transparent;
|
2024-08-05 10:11:58 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-09-12 20:32:54 +08:00
|
|
|
|
public abstract class NodeControlViewModelBase : INotifyPropertyChanged
|
2024-08-05 10:11:58 +08:00
|
|
|
|
{
|
2024-09-15 12:15:32 +08:00
|
|
|
|
public NodeControlViewModelBase(NodeModelBase node)
|
2024-09-12 20:32:54 +08:00
|
|
|
|
{
|
|
|
|
|
|
this.Node = node;
|
|
|
|
|
|
MethodDetails = this.Node.MethodDetails;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 对应的节点实体类
|
|
|
|
|
|
/// </summary>
|
2024-09-15 12:15:32 +08:00
|
|
|
|
public NodeModelBase Node { get; }
|
2024-08-05 10:11:58 +08:00
|
|
|
|
|
2024-09-12 20:32:54 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 表示节点控件是否被选中
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public bool IsSelect { get; set; } = false;
|
2024-08-05 19:43:57 +08:00
|
|
|
|
|
2024-09-12 20:32:54 +08:00
|
|
|
|
private MethodDetails methodDetails;
|
2024-08-05 10:11:58 +08:00
|
|
|
|
|
2024-08-05 19:43:57 +08:00
|
|
|
|
|
2024-08-05 10:11:58 +08:00
|
|
|
|
public MethodDetails MethodDetails
|
|
|
|
|
|
{
|
|
|
|
|
|
get => methodDetails;
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
methodDetails = value;
|
|
|
|
|
|
OnPropertyChanged();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public event PropertyChangedEventHandler PropertyChanged;
|
|
|
|
|
|
protected void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
2024-08-05 19:43:57 +08:00
|
|
|
|
|
2024-08-05 10:11:58 +08:00
|
|
|
|
{
|
|
|
|
|
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class FLowNodeObObservableCollection<T> : ObservableCollection<T>
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
public void AddRange(IEnumerable<T> items)
|
|
|
|
|
|
{
|
|
|
|
|
|
foreach (var item in items)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.Items.Add(item);
|
|
|
|
|
|
}
|
|
|
|
|
|
OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add));
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|