public LinkHost(UIElement surface, FunctionReference workflowLink, ObjectConnector source, ObjectConnector target, Orientation orientation) { Stroke = _commonBrush; StrokeThickness = 2; _workflowLink = workflowLink; _surface = surface; _source = source; _target = target; _orientation = orientation; InitializeGeometry(); }
private void OnSurfaceMouseLeftButtonDown(object sender, MouseButtonEventArgs e) { var sourceConnector = VisualTreeHelper.FindElementsInHostCoordinates(e.GetPosition(null), _surface).OfType<ObjectConnector>().FirstOrDefault(); if (sourceConnector != null && CanStartConnection(sourceConnector)) { _sourceConnector = sourceConnector; _lineGeometry = new LineGeometry(); _lineGeometry.StartPoint = _lineGeometry.EndPoint = e.GetPosition(_surface); _path = new Path { Stroke = new SolidColorBrush(Colors.Black), StrokeThickness = 2, Data = _lineGeometry }; _surface.Children.Add(_path); return; } var designerControl = VisualTreeHelper.FindElementsInHostCoordinates(e.GetPosition(null), _surface).OfType<ActivityHost>().FirstOrDefault(); if (designerControl != null) { SelectItem(designerControl); _clickPosition = e.GetPosition(designerControl); _dragStarted = true; return; } var link = VisualTreeHelper.FindElementsInHostCoordinates(e.GetPosition(null), _surface).OfType<LinkHost>().FirstOrDefault(); if (link != null) { SelectItem(link); return; } SelectItem(null); }