Files
aistudio-wpf-diagram/Extensions/AIStudio.Wpf.SFC/ViewModels/SFCConditionNode.cs

73 lines
2.1 KiB
C#
Raw Normal View History

2021-07-30 18:26:35 +08:00
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
2021-07-30 18:26:35 +08:00
using System.Text;
using System.Windows.Media;
2022-10-28 22:45:39 +08:00
using AIStudio.Wpf.DiagramDesigner;
2023-01-25 11:11:27 +08:00
using AIStudio.Wpf.DiagramDesigner.Models;
2021-07-30 18:26:35 +08:00
namespace AIStudio.Wpf.SFC.ViewModels
{
public class SFCConditionNode : SFCNode
{
2023-01-27 14:54:03 +08:00
public SFCConditionNode() : this(null)
{
}
public SFCConditionNode(IDiagramViewModel root) : base(root, SFCNodeKinds.Condition)
2021-07-30 18:26:35 +08:00
{
ColorViewModel.LineColor.Color = Colors.Black;
ItemWidth = 30;
2023-01-27 14:54:03 +08:00
ItemHeight = 30;
ExecuteAddTopInput(null);
ExecuteAddBottomOutput(null);
2021-07-30 18:26:35 +08:00
}
2023-01-24 17:53:04 +08:00
public SFCConditionNode(IDiagramViewModel root, SelectableItemBase designer) : base(root, designer)
2021-07-30 18:26:35 +08:00
{
}
2023-01-25 11:11:27 +08:00
public SFCConditionNode(IDiagramViewModel root, SerializableItem serializableItem, string serializableType) : base(root, serializableItem, serializableType)
{
}
2023-03-25 11:59:31 +08:00
protected override void Init(IDiagramViewModel root, bool initNew)
{
2023-03-25 11:59:31 +08:00
base.Init(root, initNew);
2023-02-01 23:05:56 +08:00
CustomText = true;
}
2023-03-25 11:59:31 +08:00
protected override void InitNew()
{
base.InitNew();
}
private ObservableCollection<LinkPoint> _linkPoint = new ObservableCollection<LinkPoint>();
public ObservableCollection<LinkPoint> LinkPoint
{
get
{
return _linkPoint;
}
set
{
SetProperty(ref _linkPoint, value);
}
}
protected override void ExecuteEditCommand(object parameter)
{
SFCConditionNodeData data = new SFCConditionNodeData(LinkPoint, Expression);
if (visualiserService.ShowDialog(data) == true)
{
this.LinkPoint = new ObservableCollection<LinkPoint>(data.LinkPoint.Select(p => SFCService.LinkPoint.FirstOrDefault(q => q.Name == p.Name)));
this.Expression = data.Expression;
}
}
2021-07-30 18:26:35 +08:00
}
}