using AIStudio.Wpf.DiagramDesigner; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Media; using System.Xml.Serialization; namespace AIStudio.Wpf.DiagramDesigner { [Serializable] [XmlInclude(typeof(ConnectionItem))] public class ConnectionItem : SelectableDesignerItemBase { public ConnectionItem() { } public ConnectionItem(ConnectorViewModel viewmodel) : base(viewmodel) { this.SourceId = viewmodel.SourceConnectorInfo.DataItem.Id; this.SourceOrientation = viewmodel.SourceConnectorInfo.Orientation; this.SourceType = viewmodel.SourceConnectorInfo.DataItem.GetType(); this.SourceTypeName = viewmodel.SourceConnectorInfo.DataItem.GetType().FullName; this.SourceXRatio = viewmodel.SourceConnectorInfo.GetXRatioFromConnector(); this.SourceYRatio = viewmodel.SourceConnectorInfo.GetYRatioFromConnector(); this.SourceInnerPoint = viewmodel.SourceConnectorInfo.IsInnerPoint; this.SinkId = viewmodel.SinkConnectorInfoFully.DataItem.Id; this.SinkOrientation = viewmodel.SinkConnectorInfoFully.Orientation; this.SinkType = viewmodel.SinkConnectorInfoFully.DataItem.GetType(); this.SinkTypeName = viewmodel.SinkConnectorInfoFully.DataItem.GetType().FullName; this.SinkXRatio = viewmodel.SinkConnectorInfoFully.GetXRatioFromConnector(); this.SinkYRatio = viewmodel.SinkConnectorInfoFully.GetYRatioFromConnector(); this.SinkInnerPoint = viewmodel.SinkConnectorInfoFully.IsInnerPoint; this.RouterMode = viewmodel.RouterMode; this.PathMode = viewmodel.PathMode; } //public ConnectionItem(Guid sourceId, ConnectorOrientation sourceOrientation, Type sourceType, double sourceXRatio, double sourceYRatio, bool sourceInnerPoint, // Guid sinkId, ConnectorOrientation sinkOrientation, Type sinkType, double sinkXRatio, double sinkYRatio, bool sinkInnerPoint, ConnectorViewModel viewmodel) : base(viewmodel) //{ // this.SourceId = sourceId; // this.SourceOrientation = sourceOrientation; // this.SourceType = sourceType; // this.SourceTypeName = sourceType.FullName; // this.SourceXRatio = sourceXRatio; // this.SourceYRatio = sourceYRatio; // this.SourceInnerPoint = sourceInnerPoint; // this.SinkId = sinkId; // this.SinkOrientation = sinkOrientation; // this.SinkType = sinkType; // this.SinkTypeName = sinkType.FullName; // this.SinkXRatio = sinkXRatio; // this.SinkYRatio = sinkYRatio; // this.SinkInnerPoint = sinkInnerPoint; // this.RouterMode = viewmodel.RouterMode; // this.DrawMode = viewmodel.DrawMode; //} [XmlAttribute] public Guid SourceId { get; set; } [XmlAttribute] public ConnectorOrientation SourceOrientation { get; set; } [XmlIgnore] public Type SourceType { get; set; } [XmlAttribute] public string SourceTypeName { get; set; } [XmlAttribute] public double SourceXRatio { get; set; } [XmlAttribute] public double SourceYRatio { get; set; } [XmlAttribute] public bool SourceInnerPoint { get; set; } [XmlAttribute] public Guid SinkId { get; set; } [XmlAttribute] public ConnectorOrientation SinkOrientation { get; set; } [XmlIgnore] public Type SinkType { get; set; } [XmlAttribute] public string SinkTypeName { get; set; } [XmlAttribute] public double SinkXRatio { get; set; } [XmlAttribute] public double SinkYRatio { get; set; } [XmlAttribute] public bool SinkInnerPoint { get; set; } [XmlAttribute] public string RouterMode { get; set; } [XmlAttribute] public string PathMode { get; set; } } }