コード例 #1
0
        protected override bool OnMouseMove(MouseEventArgs eventArgs)
        {
            WorkflowView parentView   = ParentView;
            Point        logicalPoint = parentView.ClientPointToLogical(new Point(eventArgs.X, eventArgs.Y));

            //We do nothing if the logical coordinate is not in the active layout
            //



            float dragMultiply = 2.0f / (float)parentView.Zoom * 100.0f;

            if (!this.dragStarted && (eventArgs.Button & MouseButtons.Left) > 0 &&
                (Math.Abs(this.startDrag.X - logicalPoint.X) > (int)(dragMultiply * (float)SystemInformation.DragSize.Width) || Math.Abs(this.startDrag.Y - logicalPoint.Y) > (int)(dragMultiply * (float)SystemInformation.DragSize.Height)))
            {
                DragStarted = true;
            }

            if (this.dragStarted)
            {
                if (!DragRectangle.IsEmpty)
                {
                    parentView.InvalidateLogicalRectangle(DragRectangle);
                }

                this.endDrag = logicalPoint;

                if (!DragRectangle.IsEmpty)
                {
                    parentView.InvalidateLogicalRectangle(DragRectangle);
                }
            }

            return(this.dragStarted);
        }
コード例 #2
0
        private void RefreshActiveGlyph(Point point)
        {
            WorkflowView parentView = base.ParentView;

            if (parentView != null)
            {
                DesignerGlyph activeGlyph = this.activeGlyph;
                if ((this.activeGlyph == null) || !this.activeGlyph.GetBounds(this.activeDesigner, true).Contains(point))
                {
                    ActivityDesigner activityDesigner = null;
                    DesignerGlyph    glyph2           = this.GlyphFromPoint(point, out activityDesigner);
                    if (this.activeGlyph != null)
                    {
                        parentView.InvalidateLogicalRectangle(this.activeGlyph.GetBounds(this.activeDesigner, true));
                    }
                    this.activeGlyph    = glyph2;
                    this.activeDesigner = activityDesigner;
                    if (this.activeGlyph != null)
                    {
                        parentView.InvalidateLogicalRectangle(this.activeGlyph.GetBounds(this.activeDesigner, true));
                    }
                }
                if (activeGlyph != this.activeGlyph)
                {
                    if ((this.activeGlyph != null) && this.activeGlyph.CanBeActivated)
                    {
                        parentView.Cursor = Cursors.Hand;
                    }
                    else if (parentView.Cursor == Cursors.Hand)
                    {
                        parentView.Cursor = Cursors.Default;
                    }
                }
            }
        }
コード例 #3
0
        internal void SetParent(FreeformActivityDesigner parentDesigner)
        {
            WorkflowView parentView = this.ParentView;

            if ((this.parentDesigner != null) && (parentView != null))
            {
                parentView.InvalidateLogicalRectangle(this.parentDesigner.Bounds);
            }
            this.parentDesigner = parentDesigner;
            if ((this.parentDesigner != null) && (parentView != null))
            {
                parentView.InvalidateLogicalRectangle(this.parentDesigner.Bounds);
            }
        }
コード例 #4
0
        protected override bool OnMouseUp(MouseEventArgs eventArgs)
        {
            if (this.dragStarted)
            {
                WorkflowView parentView = ParentView;

                //Invalidate the old rectangle so that we state the drag is complete
                if (!DragRectangle.IsEmpty)
                {
                    parentView.InvalidateLogicalRectangle(DragRectangle);
                }

                //End the actual drag/drop
                this.endDrag = parentView.ClientPointToLogical(new Point(eventArgs.X, eventArgs.Y));
                DragStarted  = false;

                //Send the notification of successful drag
                if (this.DragComplete != null)
                {
                    this.DragComplete(this, EventArgs.Empty);
                }

                return(true);
            }

            return(false);
        }
コード例 #5
0
        public void Invalidate()
        {
            WorkflowView parentView = this.ParentView;

            if (parentView != null)
            {
                parentView.InvalidateLogicalRectangle(this.Bounds);
            }
        }
コード例 #6
0
        protected void Invalidate()
        {
            WorkflowView service = this.serviceProvider.GetService(typeof(WorkflowView)) as WorkflowView;

            if (service != null)
            {
                service.InvalidateLogicalRectangle(this.bounds);
            }
        }
コード例 #7
0
        private void Invalidate()
        {
            WorkflowView service = this.GetService(typeof(WorkflowView)) as WorkflowView;

            if (service != null)
            {
                Rectangle logicalRectangle = DesignerGeometryHelper.RectangleFromLineSegments(this.GetPointsFromEditPoints(this.editPoints).ToArray());
                logicalRectangle.Inflate(1, 1);
                service.InvalidateLogicalRectangle(logicalRectangle);
            }
        }
コード例 #8
0
 private void Invalidate()
 {
     if ((this.parentDesigner != null) && (this.parentDesigner.Activity.Site != null))
     {
         WorkflowView service = this.parentDesigner.Activity.Site.GetService(typeof(WorkflowView)) as WorkflowView;
         if (service != null)
         {
             service.InvalidateLogicalRectangle(this.bounds);
         }
     }
 }
コード例 #9
0
        private void RefreshActiveGlyph(Point point)
        {
            WorkflowView parentView = ParentView;

            if (parentView != null)
            {
                DesignerGlyph previousActiveGlyph = this.activeGlyph;

                if (this.activeGlyph == null || !this.activeGlyph.GetBounds(this.activeDesigner, true).Contains(point))
                {
                    ActivityDesigner newActiveDesigner = null;
                    DesignerGlyph    newActiveGlyph    = GlyphFromPoint(point, out newActiveDesigner);

                    if (this.activeGlyph != null)
                    {
                        parentView.InvalidateLogicalRectangle(this.activeGlyph.GetBounds(this.activeDesigner, true));
                    }

                    this.activeGlyph    = newActiveGlyph;
                    this.activeDesigner = newActiveDesigner;

                    if (this.activeGlyph != null)
                    {
                        parentView.InvalidateLogicalRectangle(this.activeGlyph.GetBounds(this.activeDesigner, true));
                    }
                }

                if (previousActiveGlyph != this.activeGlyph)
                {
                    if (this.activeGlyph != null && this.activeGlyph.CanBeActivated)
                    {
                        parentView.Cursor = Cursors.Hand;
                    }
                    else if (parentView.Cursor == Cursors.Hand)
                    {
                        parentView.Cursor = Cursors.Default;
                    }
                }
            }
        }
コード例 #10
0
 private void InvalidateDraggedImages(Point[] locations)
 {
     if ((this.draggedDesignerImages != null) && (locations.Length == this.draggedDesignerImages.Count))
     {
         AmbientTheme ambientTheme = WorkflowTheme.CurrentTheme.AmbientTheme;
         WorkflowView parentView   = base.ParentView;
         for (int i = 0; i < this.draggedDesignerImages.Count; i++)
         {
             Rectangle logicalRectangle = new Rectangle(locations[i], this.draggedDesignerImages[i].Size);
             logicalRectangle.Inflate(2 * ambientTheme.Margin.Width, 2 * ambientTheme.Margin.Height);
             parentView.InvalidateLogicalRectangle(logicalRectangle);
         }
     }
 }
コード例 #11
0
        protected override bool OnMouseMove(MouseEventArgs eventArgs)
        {
            WorkflowView parentView = base.ParentView;
            Point        point      = parentView.ClientPointToLogical(new Point(eventArgs.X, eventArgs.Y));
            float        num        = (2f / ((float)parentView.Zoom)) * 100f;

            if ((!this.dragStarted && ((eventArgs.Button & MouseButtons.Left) > MouseButtons.None)) && ((Math.Abs((int)(this.startDrag.X - point.X)) > ((int)(num * SystemInformation.DragSize.Width))) || (Math.Abs((int)(this.startDrag.Y - point.Y)) > ((int)(num * SystemInformation.DragSize.Height)))))
            {
                this.DragStarted = true;
            }
            if (this.dragStarted)
            {
                if (!this.DragRectangle.IsEmpty)
                {
                    parentView.InvalidateLogicalRectangle(this.DragRectangle);
                }
                this.endDrag = point;
                if (!this.DragRectangle.IsEmpty)
                {
                    parentView.InvalidateLogicalRectangle(this.DragRectangle);
                }
            }
            return(this.dragStarted);
        }
コード例 #12
0
 public void Refresh()
 {
     if (this.previewedActivityImage != null)
     {
         this.previewedActivityImage.Dispose();
         this.previewedActivityImage = null;
     }
     if (this.serviceProvider != null)
     {
         WorkflowView service = this.serviceProvider.GetService(typeof(WorkflowView)) as WorkflowView;
         if (service != null)
         {
             service.InvalidateLogicalRectangle(this.bounds);
         }
     }
 }
コード例 #13
0
        protected override bool OnMouseUp(MouseEventArgs eventArgs)
        {
            if (!this.dragStarted)
            {
                return(false);
            }
            WorkflowView parentView = base.ParentView;

            if (!this.DragRectangle.IsEmpty)
            {
                parentView.InvalidateLogicalRectangle(this.DragRectangle);
            }
            this.endDrag     = parentView.ClientPointToLogical(new Point(eventArgs.X, eventArgs.Y));
            this.DragStarted = false;
            if (this.DragComplete != null)
            {
                this.DragComplete(this, EventArgs.Empty);
            }
            return(true);
        }
コード例 #14
0
        private void InvalidateDraggedImages(Point[] locations)
        {
            if (this.draggedDesignerImages != null)
            {
                if (locations.Length == this.draggedDesignerImages.Count)
                {
                    AmbientTheme ambientTheme = WorkflowTheme.CurrentTheme.AmbientTheme;
                    WorkflowView parentView   = ParentView;

                    //Invalidate the previous location where image was shown
                    for (int i = 0; i < this.draggedDesignerImages.Count; i++)
                    {
                        Rectangle rectangle = new Rectangle(locations[i], this.draggedDesignerImages[i].Size);
                        rectangle.Inflate(2 * ambientTheme.Margin.Width, 2 * ambientTheme.Margin.Height);
                        parentView.InvalidateLogicalRectangle(rectangle);
                    }
                }
                else
                {
                    Debug.Assert(false);
                }
            }
        }
コード例 #15
0
 internal static void SetDesignerBounds(ActivityDesigner designer, Rectangle bounds)
 {
     if (((designer != null) && (designer.Activity != null)) && (designer.Activity.Site != null))
     {
         PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(designer);
         PropertyDescriptor           descriptor = (properties != null) ? properties["Size"] : null;
         if (descriptor != null)
         {
             descriptor.SetValue(designer.Activity, bounds.Size);
         }
         else
         {
             designer.Size = bounds.Size;
         }
         PropertyDescriptor descriptor2 = (properties != null) ? properties["Location"] : null;
         if (descriptor2 != null)
         {
             descriptor2.SetValue(designer.Activity, bounds.Location);
         }
         else
         {
             designer.Location = bounds.Location;
         }
         WorkflowView service = designer.Activity.Site.GetService(typeof(WorkflowView)) as WorkflowView;
         if (service != null)
         {
             if (designer.ParentDesigner != null)
             {
                 service.InvalidateLogicalRectangle(designer.ParentDesigner.Bounds);
             }
             else
             {
                 service.Invalidate();
             }
         }
     }
 }