序列化继续整理

This commit is contained in:
艾竹
2023-01-24 17:53:04 +08:00
parent 8dbe05636d
commit 1a291411e6
72 changed files with 653 additions and 462 deletions

View File

@@ -73,7 +73,7 @@ namespace AIStudio.Wpf.DiagramDesigner
BuildMenuOptions();
}
public LogicalGateItemViewModelBase(IDiagramViewModel root, LogicalGateDesignerItemBase designer) : base(root, designer)
public LogicalGateItemViewModelBase(IDiagramViewModel root, SelectableItemBase designer) : base(root, designer)
{
BuildMenuOptions();
}
@@ -141,37 +141,31 @@ namespace AIStudio.Wpf.DiagramDesigner
{
base.LoadDesignerItemViewModel(root, designerbase);
LogicalGateDesignerItemBase designer = designerbase as LogicalGateDesignerItemBase;
this.LogicalType = designer.LogicalType;
this.OrderNumber = designer.OrderNumber;
this.Value = designer.Value;
this.IsEnabled = designer.IsEnabled;
ClearConnectors();
Input.Clear();
Output.Clear();
foreach (var connector in designer.Connectors)
if (designerbase is LogicalGateDesignerItemBase 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.LogicalType = designer.LogicalType;
this.OrderNumber = designer.OrderNumber;
this.Value = designer.Value;
this.IsEnabled = designer.IsEnabled;
if (fullyCreatedConnectorInfo.Orientation == ConnectorOrientation.Left)
ClearConnectors();
Input.Clear();
Output.Clear();
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);
}
}