Esempio n. 1
0
 public ObjectsConnector(VirtualControl host, ObjectPort sPort, ObjectPort ePort) : base(host, sPort, ePort)
 {
     Wire.Background = sPort.StrokeBrush;
     Host            = host;
     Type            = ConnectorTypes.Object;
     StartPort       = sPort;
     ePort.Linked    = true;
     sPort.Linked    = true;
     EndPort         = ePort;
     StartPort.CalcOrigin();
     EndPort.CalcOrigin();
     Sp = PointsCalculator.PortOrigin(StartPort);
     Ep = PointsCalculator.PortOrigin(EndPort);
     Wire.StartPoint = Sp;
     Wire.EndPoint   = Ep;
     ePort.Linked    = true;
     sPort.Linked    = true;
     Host.Children.Add(Wire);
     sPort.ParentNode.PropertyChanged += ParentNodeOnPropertyChanged;
     ePort.ParentNode.PropertyChanged += ParentNodeOnPropertyChanged;
     ePort.Data.Value = sPort.Data.Value;
     StartPort        = sPort;
     EndPort          = ePort;
     Wire.ContextMenu = wireMenu();
 }
Esempio n. 2
0
        public void ParentNodeOnPropertyChanged(Port s, Port e)
        {
            var sp = PointsCalculator.PortOrigin(s);
            var ep = PointsCalculator.PortOrigin(e);

            StartPoint = sp;
            EndPoint   = ep;
        }
Esempio n. 3
0
 public void ParentNodeOnPropertyChanged(object sender, PropertyChangedEventArgs propertyChangedEventArgs)
 {
     StartPort.CalcOrigin();
     EndPort.CalcOrigin();
     Sp = PointsCalculator.PortOrigin(StartPort);
     Ep = PointsCalculator.PortOrigin(EndPort);
     Wire.StartPoint = Sp;
     Wire.EndPoint   = Ep;
 }
Esempio n. 4
0
 private void OnMouseLeftButtonDown(object o, MouseButtonEventArgs mouseButtonEventArgs)
 {
     if (mouseButtonEventArgs.LeftButton != MouseButtonState.Pressed)
     {
         return;
     }
     CalcOrigin();
     Host.TempConn = new Wire
     {
         Background = StrokeBrush,
         StartPoint = PointsCalculator.PortOrigin(this),
         EndPoint   = PointsCalculator.PortOrigin(this)
     };
     Host.TemExecPort = this;
     Host.WireMode    = WireMode.FirstPortSelected;
     Host.MouseMode   = MouseMode.DraggingPort;
     Host.Children.Add(Host.TempConn);
     mouseButtonEventArgs.Handled = true;
 }
Esempio n. 5
0
 public ExecutionConnector(VirtualControl host, ExecPort sPort, ExecPort ePort) : base(host, sPort, ePort)
 {
     Host         = host;
     Type         = ConnectorTypes.Execution;
     StartPort    = sPort;
     ePort.Linked = true;
     sPort.Linked = true;
     EndPort      = ePort;
     StartPort.CalcOrigin();
     EndPort.CalcOrigin();
     Sp = PointsCalculator.PortOrigin(StartPort);
     Ep = PointsCalculator.PortOrigin(EndPort);
     Wire.StartPoint = Sp;
     Wire.EndPoint   = Ep;
     Host.Children.Add(Wire);
     sPort.ParentNode.PropertyChanged += ParentNodeOnPropertyChanged;
     ePort.ParentNode.PropertyChanged += ParentNodeOnPropertyChanged;
     Interlocked.Increment(ref StartPort.CountOutConnectors);
     Interlocked.Increment(ref EndPort.CountOutConnectors);
     Wire.ContextMenu = wireMenu();
 }