mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-03-20 16:36:36 +08:00
序列化继续整理
This commit is contained in:
@@ -16,7 +16,7 @@ namespace AIStudio.Wpf.SFC.ViewModels
|
||||
ExecuteAddLeftInput(null);
|
||||
}
|
||||
|
||||
public SFCActionNode(IDiagramViewModel root, DesignerItemBase designer) : base(root, designer)
|
||||
public SFCActionNode(IDiagramViewModel root, SelectableItemBase designer) : base(root, designer)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace AIStudio.Wpf.SFC.ViewModels
|
||||
ExecuteAddBottomOutput(null);
|
||||
}
|
||||
|
||||
public SFCCOBeginNode(IDiagramViewModel root, DesignerItemBase designer) : base(root, designer)
|
||||
public SFCCOBeginNode(IDiagramViewModel root, SelectableItemBase designer) : base(root, designer)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace AIStudio.Wpf.SFC.ViewModels
|
||||
ExecuteAddTopInput(null);
|
||||
}
|
||||
|
||||
public SFCCOEndNode(IDiagramViewModel root, DesignerItemBase designer) : base(root, designer)
|
||||
public SFCCOEndNode(IDiagramViewModel root, SelectableItemBase designer) : base(root, designer)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -43,7 +43,6 @@ namespace AIStudio.Wpf.SFC.ViewModels
|
||||
connector.XRatio = (40 + Output.Count * 200) / ItemWidth;
|
||||
Output.Add(Output.Count, connector);
|
||||
|
||||
|
||||
AddConnector(connector);
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace AIStudio.Wpf.SFC.ViewModels
|
||||
ExecuteAddBottomOutput(null);
|
||||
}
|
||||
|
||||
public SFCConditionNode(IDiagramViewModel root, DesignerItemBase designer) : base(root, designer)
|
||||
public SFCConditionNode(IDiagramViewModel root, SelectableItemBase designer) : base(root, designer)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace AIStudio.Wpf.SFC.ViewModels
|
||||
ItemHeight = 40;
|
||||
}
|
||||
|
||||
public SFCNode(IDiagramViewModel root, DesignerItemBase designer) : base(root, designer)
|
||||
public SFCNode(IDiagramViewModel root, SelectableItemBase designer) : base(root, designer)
|
||||
{
|
||||
|
||||
}
|
||||
@@ -58,53 +58,46 @@ namespace AIStudio.Wpf.SFC.ViewModels
|
||||
{
|
||||
base.LoadDesignerItemViewModel(root, designerbase);
|
||||
|
||||
SFCNodeDesignerItem designer = designerbase as SFCNodeDesignerItem;
|
||||
this.Kind = designer.Kind;
|
||||
this.Expression = designer.Expression;
|
||||
|
||||
foreach (var connector in designer.Connectors)
|
||||
if (designerbase is SFCNodeDesignerItem designer)
|
||||
{
|
||||
FullyCreatedConnectorInfo fullyCreatedConnectorInfo = new FullyCreatedConnectorInfo(this, connector.Orientation, true);
|
||||
fullyCreatedConnectorInfo.XRatio = connector.XRatio;
|
||||
fullyCreatedConnectorInfo.YRatio = connector.YRatio;
|
||||
fullyCreatedConnectorInfo.ConnectorWidth = connector.ConnectorWidth;
|
||||
fullyCreatedConnectorInfo.ConnectorHeight = connector.ConnectorHeight;
|
||||
fullyCreatedConnectorInfo.Orientation = connector.Orientation;
|
||||
fullyCreatedConnectorInfo.IsInnerPoint = connector.IsInnerPoint;
|
||||
fullyCreatedConnectorInfo.ValueTypePoint = connector.ValueTypePoint;
|
||||
fullyCreatedConnectorInfo.ConnectorValue = connector.ConnectorValue;
|
||||
this.Kind = designer.Kind;
|
||||
this.Expression = designer.Expression;
|
||||
|
||||
if (fullyCreatedConnectorInfo.Orientation == ConnectorOrientation.Left)
|
||||
foreach (var connector in designer.Connectors)
|
||||
{
|
||||
Input.Add(Input.Count, fullyCreatedConnectorInfo);
|
||||
FullyCreatedConnectorInfo fullyCreatedConnectorInfo = new FullyCreatedConnectorInfo(this.Root, this, connector);
|
||||
if (fullyCreatedConnectorInfo.Orientation == ConnectorOrientation.Left)
|
||||
{
|
||||
Input.Add(Input.Count, fullyCreatedConnectorInfo);
|
||||
}
|
||||
else if (fullyCreatedConnectorInfo.Orientation == ConnectorOrientation.Right)
|
||||
{
|
||||
Output.Add(Output.Count, fullyCreatedConnectorInfo);
|
||||
}
|
||||
AddConnector(fullyCreatedConnectorInfo);
|
||||
}
|
||||
else if (fullyCreatedConnectorInfo.Orientation == ConnectorOrientation.Right)
|
||||
{
|
||||
Output.Add(Output.Count, fullyCreatedConnectorInfo);
|
||||
}
|
||||
AddConnector(fullyCreatedConnectorInfo);
|
||||
}
|
||||
|
||||
if (this is SFCActionNode actionNode)
|
||||
{
|
||||
actionNode.LinkPoint = designer.LinkPoints.FirstOrDefault();
|
||||
}
|
||||
else if (this is SFCConditionNode sFCConditionNode)
|
||||
{
|
||||
sFCConditionNode.LinkPoint = new System.Collections.ObjectModel.ObservableCollection<LinkPoint>(designer.LinkPoints);
|
||||
}
|
||||
else if (this is Simulate_SolenoidViewModel simulate_SolenoidViewModel)
|
||||
{
|
||||
simulate_SolenoidViewModel.DILinkPoint = designer.LinkPoints.FirstOrDefault();
|
||||
simulate_SolenoidViewModel.DOLinkPoint = designer.LinkPoints.LastOrDefault();
|
||||
}
|
||||
else if (this is Simulate_StartViewModel simulate_StartViewModel)
|
||||
{
|
||||
simulate_StartViewModel.LinkPoint = designer.LinkPoints.FirstOrDefault();
|
||||
}
|
||||
else if (this is Simulate_TankViewModel simulate_TankViewModel)
|
||||
{
|
||||
simulate_TankViewModel.LinkPoint = designer.LinkPoints.FirstOrDefault();
|
||||
if (this is SFCActionNode actionNode)
|
||||
{
|
||||
actionNode.LinkPoint = designer.LinkPoints.FirstOrDefault();
|
||||
}
|
||||
else if (this is SFCConditionNode sFCConditionNode)
|
||||
{
|
||||
sFCConditionNode.LinkPoint = new System.Collections.ObjectModel.ObservableCollection<LinkPoint>(designer.LinkPoints);
|
||||
}
|
||||
else if (this is Simulate_SolenoidViewModel simulate_SolenoidViewModel)
|
||||
{
|
||||
simulate_SolenoidViewModel.DILinkPoint = designer.LinkPoints.FirstOrDefault();
|
||||
simulate_SolenoidViewModel.DOLinkPoint = designer.LinkPoints.LastOrDefault();
|
||||
}
|
||||
else if (this is Simulate_StartViewModel simulate_StartViewModel)
|
||||
{
|
||||
simulate_StartViewModel.LinkPoint = designer.LinkPoints.FirstOrDefault();
|
||||
}
|
||||
else if (this is Simulate_TankViewModel simulate_TankViewModel)
|
||||
{
|
||||
simulate_TankViewModel.LinkPoint = designer.LinkPoints.FirstOrDefault();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace AIStudio.Wpf.SFC.ViewModels
|
||||
ExecuteAddActionOutput(null);
|
||||
}
|
||||
|
||||
public SFCNodeNode(IDiagramViewModel root, DesignerItemBase designer) : base(root, designer)
|
||||
public SFCNodeNode(IDiagramViewModel root, SelectableItemBase designer) : base(root, designer)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace AIStudio.Wpf.SFC.ViewModels
|
||||
ExecuteAddBottomOutput(null);
|
||||
}
|
||||
|
||||
public SFCStartNode(IDiagramViewModel root, DesignerItemBase designer) : base(root, designer)
|
||||
public SFCStartNode(IDiagramViewModel root, SelectableItemBase designer) : base(root, designer)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace AIStudio.Wpf.SFC.ViewModels
|
||||
ItemHeight = 260;
|
||||
}
|
||||
|
||||
public Simulate_ListViewModel(IDiagramViewModel root, DesignerItemBase designer) : base(root, designer)
|
||||
public Simulate_ListViewModel(IDiagramViewModel root, SelectableItemBase designer) : base(root, designer)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace AIStudio.Wpf.SFC.ViewModels
|
||||
ExecuteAddRightOutput(null);
|
||||
}
|
||||
|
||||
public Simulate_SolenoidViewModel(IDiagramViewModel root, DesignerItemBase designer) : base(root, designer)
|
||||
public Simulate_SolenoidViewModel(IDiagramViewModel root, SelectableItemBase designer) : base(root, designer)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace AIStudio.Wpf.SFC.ViewModels
|
||||
ExecuteAddRightOutput(null);
|
||||
}
|
||||
|
||||
public Simulate_StartViewModel(IDiagramViewModel root, DesignerItemBase designer) : base(root, designer)
|
||||
public Simulate_StartViewModel(IDiagramViewModel root, SelectableItemBase designer) : base(root, designer)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace AIStudio.Wpf.SFC.ViewModels
|
||||
ExecuteAddRightOutput(null);
|
||||
}
|
||||
|
||||
public Simulate_TankViewModel(IDiagramViewModel root, DesignerItemBase designer) : base(root, designer)
|
||||
public Simulate_TankViewModel(IDiagramViewModel root, SelectableItemBase designer) : base(root, designer)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user