コード例 #1
0
        private void RemovePort(SPort port)
        {
            var target   = port.Direction == PortDirection.Input ? inputContainer : outputContainer;
            var portView = target.Children().OfType <BasePortView>().First(v => v.Port.Id == port.Id);

            target.Remove(portView);
            _ports.Remove(portView);
        }
コード例 #2
0
        private void AddPort(SPort port)
        {
            var target   = port.Direction == PortDirection.Input ? inputContainer : outputContainer;
            var portView = CreatePortView(port);

            target.Add(portView);
            _ports.Add(portView);
        }
コード例 #3
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="port">Port that needs view</param>
        /// <param name="portOrientation">Orientation of port</param>
        /// <param name="edgeConnectorListener">Edge connector listener for a port</param>
        public BasePortView(SPort port, Orientation portOrientation, IEdgeConnectorListener edgeConnectorListener)
            : base(portOrientation,
                   port.Direction == PortDirection.Input ? Direction.Input : Direction.Output,
                   port.Capacity == PortCapacity.Multiple ? Capacity.Multi : Capacity.Single,
                   port.Type)
        {
            Port            = port;
            portName        = ObjectNames.NicifyVariableName(port.Id);
            m_EdgeConnector = CreateEdgeConnector(edgeConnectorListener);
            this.AddManipulator(m_EdgeConnector);

            tooltip = port.Type.ToString();
        }
コード例 #4
0
 /// <summary>
 /// Creates a view for <see cref="PortModel"/>.
 /// Override this to create custom view
 /// </summary>
 /// <param name="port"></param>
 protected virtual BasePortView CreatePortView(SPort port)
 {
     return(new BasePortView(port, Orientation.Horizontal, EdgeConnectorListener));
 }
コード例 #5
0
 public void Init(IGraphType graphType, SPort fromPort, Func <SearchWindowResult, bool> nodeCreationRequested)
 {
     _graphType             = graphType;
     _fromPort              = fromPort;
     _nodeCreationRequested = nodeCreationRequested;
 }
コード例 #6
0
 public static IEnumerable <SConnection> GetConnections(this SGraph graph, SPort port)
 {
     return(graph.Connections.Where(connection => (connection.FromPortId == port.Id && connection.FromNodeId == port.NodeId) ||
                                    (connection.ToPortId == port.Id && connection.ToNodeId == port.NodeId)));
 }