mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-03-15 22:16:37 +08:00
序列化继续整理
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user