Пример #1
0
        public static Point GetPointForConnector(FullyCreatedConnectorInfo connector)
        {
            var point = new Point();

            switch (connector.Orientation)
            {
            case ConnectorOrientation.Top:
                point = new Point(connector.DataItem.Left + DesignerItemViewModelBase.ItemWidth / 2,
                                  connector.DataItem.Top - ConnectorInfoBase.ConnectorHeight);
                break;

            case ConnectorOrientation.Bottom:
                point = new Point(connector.DataItem.Left + DesignerItemViewModelBase.ItemWidth / 2,
                                  connector.DataItem.Top + DesignerItemViewModelBase.ItemHeight +
                                  ConnectorInfoBase.ConnectorHeight / 2);
                break;

            case ConnectorOrientation.Right:
                point = new Point(
                    connector.DataItem.Left + DesignerItemViewModelBase.ItemWidth +
                    ConnectorInfoBase.ConnectorWidth,
                    connector.DataItem.Top + DesignerItemViewModelBase.ItemHeight / 2);
                break;

            case ConnectorOrientation.Left:
                point = new Point(connector.DataItem.Left - ConnectorInfoBase.ConnectorWidth,
                                  connector.DataItem.Top + DesignerItemViewModelBase.ItemHeight / 2);
                break;
            }

            return(point);
        }
Пример #2
0
 public ConnectorViewModel(FullyCreatedConnectorInfo sourceConnectorInfo, ConnectorInfoBase sinkConnectorInfo)
 {
     Init(sourceConnectorInfo, sinkConnectorInfo);
 }
Пример #3
0
 public ConnectorViewModel(int id, IDiagramViewModel parent,
                           FullyCreatedConnectorInfo sourceConnectorInfo, FullyCreatedConnectorInfo sinkConnectorInfo) : base(id,
                                                                                                                              parent)
 {
     Init(sourceConnectorInfo, sinkConnectorInfo);
 }