Exemplo n.º 1
0
        private DesignerGlyph[] CreateConnectorDragDropGlyphs()
        {
            //see if there's a drag'n'drop operation going on
            WorkflowView    parentView      = ParentView;
            DragDropManager dragDropManager = GetService(typeof(DragDropManager)) as DragDropManager;

            if (parentView == null || dragDropManager == null || !parentView.DragDropInProgress || DrawingState != DrawingStates.Valid)
            {
                return new DesignerGlyph[] { }
            }
            ;

            List <DesignerGlyph> glyphs          = new List <DesignerGlyph>();
            Rectangle            logicalViewPort = parentView.ClientRectangleToLogical(new Rectangle(Point.Empty, parentView.ViewPortSize));
            AmbientTheme         ambientTheme    = WorkflowTheme.CurrentTheme.AmbientTheme;

            Rectangle[] connectors        = GetConnectors();
            Rectangle   helpTextRectangle = HelpTextRectangle;

            for (int i = 0; i < connectors.Length; i++)
            {
                if (logicalViewPort.IntersectsWith(connectors[i]) && i != CurrentDropTarget && dragDropManager.IsValidDropContext(new ConnectorHitTestInfo(this, HitTestLocations.Designer, i)))
                {
                    Point glyphLocation = Point.Empty;
                    if (helpTextRectangle.IsEmpty)
                    {
                        glyphLocation = new Point(connectors[i].Location.X + connectors[i].Size.Width / 2 + 1, connectors[i].Location.Y + connectors[i].Size.Height / 2);
                    }
                    else
                    {
                        glyphLocation = new Point(helpTextRectangle.Left + helpTextRectangle.Width / 2 + 1, helpTextRectangle.Top - ambientTheme.DropIndicatorSize.Height / 2);
                    }

                    glyphs.Add(new ConnectorDragDropGlyph(i, glyphLocation));
                }
            }

            return(glyphs.ToArray());
        }