コード例 #1
0
 /// <summary>
 /// Gets the glyphs for the associated activity designer
 /// </summary>
 /// <param name="activityDesigner"></param>
 /// <returns></returns>
 public ActivityDesignerGlyphCollection GetGlyphs(ActivityDesigner activityDesigner)
 {
     ActivityDesignerGlyphCollection glyphs = new ActivityDesignerGlyphCollection();
     //The glyph position indicates how far down the glyph is drawn
     int glyphPosition = -1;
     string validationError = string.Empty;            
     if (profileManager.IsActivityValid(activityDesigner.Activity, out validationError))
     {
         //Add an error glyph if the selected activity is not configured correctly
         ++glyphPosition;
         glyphs.Add(new ErrorActivityGlyph(validationError));
     }
     if (profileManager.IsTracked(activityDesigner.Activity))
     {
         //Add the glyph for the trackpoint
         glyphs.Add(new TrackedActivityGlyph(++glyphPosition, redPin));
     }
     if (profileManager.IsMatchedByDerivedTrackPoint(activityDesigner.Activity))
     {
         //Add faded derive match glyph
         glyphs.Add(new TrackedActivityGlyph(++glyphPosition, fadedRedPin));
     }
     string annotation = profileManager.GetAnnotation(activityDesigner.Activity);
     if (annotation != null)
     {
         //If an annotation exists, use the tooltip via the description.
         activityDesigner.Activity.Description = annotation;                
     }
     return glyphs;
 }
コード例 #2
0
 protected override void OnPaint(Graphics graphics, bool activated, AmbientTheme ambientTheme, ActivityDesigner designer)
 {
     Rectangle bounds = GetBounds(designer, activated);
     graphics.FillRectangle(AmbientTheme.FadeBrush, bounds);
     graphics.FillRectangle(ambientTheme.CommentIndicatorBrush, bounds);
     graphics.DrawRectangle(ambientTheme.CommentIndicatorPen, bounds);
 }
コード例 #3
0
 public static void PaintDesigner(ActivityDesigner activityDesigner, ActivityDesignerPaintEventArgs eventArgs)
 {
     if (activityDesigner == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("activityDesigner");
     }
     if (eventArgs == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("eventArgs");
     }
     ActivityDesigner parentDesigner = activityDesigner.ParentDesigner;
     if (parentDesigner == null)
     {
         // This designer is no more on the design surface , dont paint this.
         return;
     }
     if (!IsBranchVisible(activityDesigner))
     {
         return;
     }
     // special case designers contained inside activity preview designers ( only one of the contained designers is shown)
     bool visible = false;
     if (IsInsidePreviewDesignerBranch(activityDesigner, out visible))
     {
         if (visible)
         {
             PaintDesignerInternal(activityDesigner, eventArgs);
         }
     }
     else
     {
         PaintDesignerInternal(activityDesigner, eventArgs);
     }
 }
コード例 #4
0
        public virtual Rectangle[] GetGrabHandles(ActivityDesigner designer) 
        {
            Size selectionSize = WorkflowTheme.CurrentTheme.AmbientTheme.SelectionSize;
            Size grabHandleSize = new Size(selectionSize.Width, selectionSize.Height);
            Rectangle selectionRect = GetBounds(designer, false);
            selectionRect.Inflate(selectionSize.Width, selectionSize.Height);

            //we need grab handles only in case this activity is an immediate child of a free-form activity
            //otherwise, no grab handles

            ActivityDesigner parentDesigner = designer.ParentDesigner;
            Rectangle[] grabHandles = null;
            if (parentDesigner != null && parentDesigner is FreeformActivityDesigner)
            {
                grabHandles = new Rectangle[8];
                grabHandles[0] = new Rectangle(selectionRect.Location, grabHandleSize);
                grabHandles[1] = new Rectangle(new Point(selectionRect.Left + (selectionRect.Width - grabHandleSize.Width) / 2, selectionRect.Top), grabHandleSize);
                grabHandles[2] = new Rectangle(selectionRect.Right - grabHandleSize.Width, selectionRect.Top, grabHandleSize.Width, grabHandleSize.Height);
                grabHandles[3] = new Rectangle(new Point(selectionRect.Right - grabHandleSize.Width, selectionRect.Top + (selectionRect.Height - grabHandleSize.Height) / 2), grabHandleSize);
                grabHandles[4] = new Rectangle(selectionRect.Right - grabHandleSize.Width, selectionRect.Bottom - grabHandleSize.Height, grabHandleSize.Width, grabHandleSize.Height);
                grabHandles[5] = new Rectangle(new Point(selectionRect.Left + (selectionRect.Width - grabHandleSize.Width) / 2, selectionRect.Bottom - grabHandleSize.Height), grabHandleSize);
                grabHandles[6] = new Rectangle(selectionRect.Left, selectionRect.Bottom - grabHandleSize.Height, grabHandleSize.Width, grabHandleSize.Height);
                grabHandles[7] = new Rectangle(new Point(selectionRect.Left, selectionRect.Top + (selectionRect.Height - grabHandleSize.Height) / 2), grabHandleSize);
                return grabHandles;
            }
            else
            {
                grabHandles = new Rectangle[1];
                grabHandles[0] = new Rectangle(selectionRect.Location, grabHandleSize);
            }

            return grabHandles;            
        }
 private DesignerEdges GetSizingEdge(ActivityDesigner designer, Point point)
 {
     DesignerEdges none = DesignerEdges.None;
     Size selectionSize = WorkflowTheme.CurrentTheme.AmbientTheme.SelectionSize;
     Rectangle bounds = designer.Bounds;
     Point[] line = new Point[] { new Point(bounds.Left, bounds.Top), new Point(bounds.Left, bounds.Bottom) };
     if (Math.Floor(DesignerGeometryHelper.DistanceFromPointToLineSegment(point, line)) <= (selectionSize.Width + 1))
     {
         none |= DesignerEdges.Left;
     }
     Point[] pointArray2 = new Point[] { new Point(bounds.Left, bounds.Top), new Point(bounds.Right, bounds.Top) };
     if (Math.Floor(DesignerGeometryHelper.DistanceFromPointToLineSegment(point, pointArray2)) <= (selectionSize.Height + 1))
     {
         none |= DesignerEdges.Top;
     }
     Point[] pointArray3 = new Point[] { new Point(bounds.Right, bounds.Top), new Point(bounds.Right, bounds.Bottom) };
     if (Math.Floor(DesignerGeometryHelper.DistanceFromPointToLineSegment(point, pointArray3)) <= (selectionSize.Width + 1))
     {
         none |= DesignerEdges.Right;
     }
     Point[] pointArray4 = new Point[] { new Point(bounds.Left, bounds.Bottom), new Point(bounds.Right, bounds.Bottom) };
     if (Math.Floor(DesignerGeometryHelper.DistanceFromPointToLineSegment(point, pointArray4)) <= (selectionSize.Height + 1))
     {
         none |= DesignerEdges.Bottom;
     }
     return none;
 }
コード例 #6
0
 protected override void OnPaint(Graphics graphics, bool activated, AmbientTheme ambientTheme, ActivityDesigner designer)
 {
     Bitmap bitmap = Resources.Executing;
     bitmap.MakeTransparent(Color.FromArgb(0, 255, 255));
     if (bitmap != null)
         graphics.DrawImage(bitmap, GetBounds(designer, activated), new Rectangle(Point.Empty, bitmap.Size), GraphicsUnit.Pixel);
 }
コード例 #7
0
        protected override bool OnMouseMove(MouseEventArgs eventArgs)
        {
            Point clientPoint = new Point(eventArgs.X, eventArgs.Y);

            //If the mouse is not in a valid area then we return
            if (!ParentView.IsClientPointInActiveLayout(clientPoint))
            {
                if (this.currentActiveDesigner != null)
                    ((IWorkflowDesignerMessageSink)this.currentActiveDesigner).OnMouseLeave();
                this.currentActiveDesigner = null;
                return true;
            }

            //Now check which designer is hit
            HitTestInfo hitTestInfo = MessageHitTestContext;
            if (this.currentActiveDesigner != hitTestInfo.AssociatedDesigner)
            {
                if (this.currentActiveDesigner != null)
                    ((IWorkflowDesignerMessageSink)this.currentActiveDesigner).OnMouseLeave();

                this.currentActiveDesigner = hitTestInfo.AssociatedDesigner;

                if (this.currentActiveDesigner != null)
                    ((IWorkflowDesignerMessageSink)this.currentActiveDesigner).OnMouseEnter(eventArgs);
            }
            else
            {
                if (this.currentActiveDesigner != null)
                    ((IWorkflowDesignerMessageSink)this.currentActiveDesigner).OnMouseMove(eventArgs);
            }

            return false;
        }
コード例 #8
0
            public DesignerLayoutConnectionPoint(ActivityDesigner associatedDesigner, int connectionIndex, CompositeActivity eventHandler, DesignerEdges designerEdges)
                : base(associatedDesigner, designerEdges, connectionIndex)
            {
                Debug.Assert(designerEdges == DesignerEdges.Left || designerEdges == DesignerEdges.Right);
                _eventHandler = eventHandler;
                _designerEdges = designerEdges;

            }
コード例 #9
0
 protected override void OnPaint(Graphics graphics, bool activated, AmbientTheme ambientTheme, ActivityDesigner designer)
 {
     if (!this.GetBounds(designer, activated).Size.IsEmpty)
     {
         bool roundEdges = (designer.DesignerTheme.DesignerGeometry == DesignerGeometry.RoundedRectangle) && !designer.IsRootDesigner;
         ActivityDesignerPaint.DrawDropShadow(graphics, designer.Bounds, designer.DesignerTheme.BorderPen.Color, 4, LightSourcePosition.Top | LightSourcePosition.Left, 0.5f, roundEdges);
     }
 }
コード例 #10
0
        public DesignerView(int viewId, string text, Image image, ActivityDesigner associatedDesigner)
            : this(viewId, text, image)
        {
            if (associatedDesigner == null)
                throw new ArgumentNullException("associatedDesigner");

            this.designer = associatedDesigner;
        }
コード例 #11
0
 public virtual Rectangle GetBounds(ActivityDesigner designer, bool activated)
 {
     if (designer == null)
     {
         throw new ArgumentNullException("designer");
     }
     return designer.Bounds;
 }
コード例 #12
0
            public override Rectangle GetBounds(ActivityDesigner designer, bool activated)
            {
                if (designer == null)
                    throw new ArgumentNullException("designer");

                Rectangle bounds = _layout.Bounds;
                return bounds;
            }
コード例 #13
0
        public override Rectangle GetBounds(ActivityDesigner designer, bool activated)
        {
            if (designer == null)
                throw new ArgumentNullException("designer");

            Rectangle rectangle = designer.Bounds;
            rectangle.Inflate(WorkflowTheme.CurrentTheme.AmbientTheme.SelectionSize.Width / 2, WorkflowTheme.CurrentTheme.AmbientTheme.SelectionSize.Height / 2);
            return rectangle;
        }
コード例 #14
0
        /// <summary>
        /// Constructs the accessibility class for ActivityDesigner
        /// </summary>
        /// <param name="activityDesigner">ActivityDesigner associated with accessiblity object</param>
        public ActivityDesignerAccessibleObject(ActivityDesigner activityDesigner)
        {
            if (activityDesigner == null)
                throw new ArgumentNullException("activityDesigner");
            if (activityDesigner.Activity == null)
                throw new ArgumentException(DR.GetString(DR.DesignerNotInitialized), "activityDesigner");

            this.activityDesigner = activityDesigner;
        }
コード例 #15
0
 public HitTestInfo(ActivityDesigner designer, HitTestLocations location)
 {
     if (designer == null)
     {
         throw new ArgumentNullException("designer");
     }
     this.activityDesigner = designer;
     this.location = location;
 }
コード例 #16
0
 protected override void OnPaint(Graphics graphics, bool activated, AmbientTheme ambientTheme, ActivityDesigner designer)
 {
     Rectangle bounds = GetBounds(designer, activated);
     if (!bounds.Size.IsEmpty)
     {
         bool drawRounded = (designer.DesignerTheme.DesignerGeometry == DesignerGeometry.RoundedRectangle && !designer.IsRootDesigner);
         ActivityDesignerPaint.DrawDropShadow(graphics, designer.Bounds, designer.DesignerTheme.BorderPen.Color, AmbientTheme.DropShadowWidth, LightSourcePosition.Left | LightSourcePosition.Top, 0.5f, drawRounded);
     }
 }
 protected override void OnActivate(ActivityDesigner designer)
 {
     if ((designer != null) && (designer.DesignerActions.Count > 0))
     {
         Rectangle bounds = this.GetBounds(designer, false);
         Point location = designer.ParentView.LogicalPointToScreen(new Point(bounds.Left, bounds.Bottom));
         DesignerHelpers.ShowDesignerVerbs(designer, location, DesignerHelpers.GetDesignerActionVerbs(designer, designer.DesignerActions));
     }
 }
コード例 #18
0
 protected override bool OnDragEnter(DragEventArgs eventArgs)
 {
     if (this.currentActiveDesigner != null)
     {
         ((IWorkflowDesignerMessageSink) this.currentActiveDesigner).OnMouseLeave();
         this.currentActiveDesigner = null;
     }
     return false;
 }
コード例 #19
0
        public override Rectangle GetBounds(ActivityDesigner designer, bool activated)
        {
            if (designer == null)
                throw new ArgumentNullException("designer");

            Rectangle bounds = designer.Bounds;
            bounds.Inflate(AmbientTheme.DropShadowWidth + 1, AmbientTheme.DropShadowWidth + 1);
            return bounds;
        }
コード例 #20
0
        public override Rectangle GetBounds(ActivityDesigner designer, bool activated)
        {
            if (designer == null)
                throw new ArgumentNullException("designer");

            Rectangle bounds = designer.Bounds;
            bounds.Inflate(WorkflowTheme.CurrentTheme.AmbientTheme.Margin);
            return bounds;
        }
コード例 #21
0
 public override Rectangle GetBounds(ActivityDesigner designer, bool activated)
 {
     if (designer == null)
     {
         throw new ArgumentNullException("designer");
     }
     Rectangle bounds = designer.Bounds;
     bounds.Inflate(5, 5);
     return bounds;
 }
コード例 #22
0
 protected override void OnPaint(Graphics graphics, bool activated, AmbientTheme ambientTheme, ActivityDesigner designer)
 {
     if (designer == null)
         throw new ArgumentNullException("designer");
     if (graphics == null)
         throw new ArgumentNullException("graphics");
     Rectangle bounds = GetBounds(designer, false);
     graphics.FillRectangle(StateMachineDesignerPaint.FadeBrush, bounds);
     graphics.FillRectangle(ambientTheme.CommentIndicatorBrush, bounds);
     graphics.DrawRectangle(ambientTheme.CommentIndicatorPen, bounds);
 }
コード例 #23
0
 internal void DrawDesignerGlyphs(ActivityDesignerPaintEventArgs e, ActivityDesigner designer)
 {
     foreach (DesignerGlyph glyph in this.GetDesignerGlyphs(designer))
     {
         glyph.Draw(e.Graphics, designer);
     }
     if ((this.activeGlyph != null) && (designer == this.activeDesigner))
     {
         this.activeGlyph.DrawActivated(e.Graphics, this.activeDesigner);
     }
 }
コード例 #24
0
 protected override void Dispose(bool disposing)
 {
     this.designerGlyphProviders.Clear();
     this.activeGlyph = null;
     this.activeDesigner = null;
     IServiceContainer service = base.GetService(typeof(IServiceContainer)) as IServiceContainer;
     if ((service != null) && (base.GetService(typeof(IDesignerGlyphProviderService)) != null))
     {
         service.RemoveService(typeof(IDesignerGlyphProviderService));
     }
     base.Dispose(disposing);
 }
 public void BringToFront(ActivityDesigner containedDesigner)
 {
     if (containedDesigner == null)
     {
         throw new ArgumentNullException("containedDesigner");
     }
     if (!this.ContainedDesigners.Contains(containedDesigner))
     {
         throw new ArgumentException(DR.GetString("InvalidDesignerSpecified", new object[] { "containedDesigner" }));
     }
     this.UpdateZOrder(containedDesigner, ZOrder.Foreground);
 }
コード例 #26
0
 public override Rectangle GetBounds(ActivityDesigner designer, bool activated)
 {
     Rectangle imageBounds = Rectangle.Empty;
     Image image = Resources.Executing;
     if (image != null)
     {
         Size glyphSize = WorkflowTheme.CurrentTheme.AmbientTheme.GlyphSize;
         imageBounds.Location = new Point(designer.Bounds.Right - glyphSize.Width / 2, designer.Bounds.Top - glyphSize.Height / 2);
         imageBounds.Size = glyphSize;
     }
     return imageBounds;
 }
 private bool CanResizeDesigner(ActivityDesigner designer)
 {
     if (!designer.EnableVisualResizing)
     {
         return false;
     }
     if (designer.ParentDesigner == null)
     {
         return true;
     }
     FreeformActivityDesigner parentDesigner = designer.ParentDesigner as FreeformActivityDesigner;
     return ((parentDesigner != null) && parentDesigner.CanResizeContainedDesigner(designer));
 }
コード例 #28
0
 public virtual Rectangle[] GetGrabHandles(ActivityDesigner designer)
 {
     Size selectionSize = WorkflowTheme.CurrentTheme.AmbientTheme.SelectionSize;
     Size size = new Size(selectionSize.Width, selectionSize.Height);
     Rectangle bounds = this.GetBounds(designer, false);
     bounds.Inflate(selectionSize.Width, selectionSize.Height);
     ActivityDesigner parentDesigner = designer.ParentDesigner;
     if ((parentDesigner != null) && (parentDesigner is FreeformActivityDesigner))
     {
         return new Rectangle[] { new Rectangle(bounds.Location, size), new Rectangle(new Point(bounds.Left + ((bounds.Width - size.Width) / 2), bounds.Top), size), new Rectangle(bounds.Right - size.Width, bounds.Top, size.Width, size.Height), new Rectangle(new Point(bounds.Right - size.Width, bounds.Top + ((bounds.Height - size.Height) / 2)), size), new Rectangle(bounds.Right - size.Width, bounds.Bottom - size.Height, size.Width, size.Height), new Rectangle(new Point(bounds.Left + ((bounds.Width - size.Width) / 2), bounds.Bottom - size.Height), size), new Rectangle(bounds.Left, bounds.Bottom - size.Height, size.Width, size.Height), new Rectangle(new Point(bounds.Left, bounds.Top + ((bounds.Height - size.Height) / 2)), size) };
     }
     return new Rectangle[] { new Rectangle(bounds.Location, size) };
 }
 protected override void OnPaint(Graphics graphics, bool activated, AmbientTheme ambientTheme, ActivityDesigner designer)
 {
     if (((designer.Activity != null) && (designer.Activity.Site != null)) && (this.connectionPoint != null))
     {
         WorkflowView service = designer.Activity.Site.GetService(typeof(WorkflowView)) as WorkflowView;
         Rectangle viewPort = (service != null) ? service.ViewPortRectangle : Rectangle.Empty;
         Rectangle clipRectangle = (designer.ParentDesigner != null) ? designer.ParentDesigner.Bounds : designer.Bounds;
         ConnectionManager manager = designer.Activity.Site.GetService(typeof(ConnectionManager)) as ConnectionManager;
         ActivityDesignerPaintEventArgs e = new ActivityDesignerPaintEventArgs(graphics, clipRectangle, viewPort, designer.DesignerTheme);
         bool drawHighlighted = (manager != null) && this.connectionPoint.Equals(manager.SnappedConnectionPoint);
         this.connectionPoint.OnPaint(e, drawHighlighted);
     }
 }
コード例 #30
0
 public DesignerAction(ActivityDesigner activityDesigner, int actionId, string text)
 {
     if (activityDesigner == null)
     {
         throw new ArgumentNullException("activityDesigner");
     }
     if ((text == null) || (text.Length == 0))
     {
         throw new ArgumentException(SR.GetString("Error_NullOrEmptyValue"), "text");
     }
     this.activityDesigner = activityDesigner;
     this.actionId = actionId;
     this.text = text;
 }