Esempio n. 1
0
        public void ReloadWorkflowOutline()
        {
            this.OnBeginUpdate();
            this.treeView.BeginUpdate();
            try
            {
                this.treeView.Nodes.Clear();
                this.activityToNodeMapping.Clear();
                IRootDesigner safeRootDesigner = ActivityDesigner.GetSafeRootDesigner(this.serviceProvider);
                if (((safeRootDesigner != null) && (safeRootDesigner.Component != null)) && (safeRootDesigner.Component is Activity))
                {
                    this.InsertDocOutlineNode(null, safeRootDesigner.Component as Activity, 0, true);
                }
                if (this.NeedsExpandAll)
                {
                    this.treeView.ExpandAll();
                }
            }
            finally
            {
                this.treeView.EndUpdate();
            }
            this.IsDirty = false;
            ISelectionService service = this.GetService(typeof(ISelectionService)) as ISelectionService;

            if ((service != null) && (service.PrimarySelection != null))
            {
                this.treeView.SelectedNode = this.activityToNodeMapping[service.PrimarySelection] as WorkflowOutlineNode;
                if (this.treeView.SelectedNode != null)
                {
                    this.treeView.SelectedNode.EnsureVisible();
                }
            }
            this.OnEndUpdate();
        }
Esempio n. 2
0
        protected override bool OnDragLeave()
        {
            //Invalidate so that we can clear the drag image and active placement glyphs
            WorkflowView parentView = ParentView;

            parentView.InvalidateClientRectangle(Rectangle.Empty);

            DestroyDragFeedbackImages();

            //Clear the control key flag
            this.wasCtrlKeyPressed = false;

            //Now we fire the drag leave event
            if (this.dropTargetDesigner != null)
            {
                ((IWorkflowDesignerMessageSink)this.dropTargetDesigner).OnDragLeave();
            }

            //Clear the buffered designer as the drag drop has ended
            this.dropTargetDesigner = null;
            this.draggedActivities.Clear();
            this.exceptionInDragDrop = false;

            return(true);
        }
Esempio n. 3
0
        protected override bool OnMouseMove(MouseEventArgs eventArgs)
        {
            WorkflowView parentView = base.ParentView;

            if (parentView == null)
            {
                throw new InvalidOperationException(DR.GetString("WorkflowViewNull", new object[0]));
            }
            bool          flag        = false;
            Point         clientPoint = new Point(eventArgs.X, eventArgs.Y);
            Point         point       = parentView.ClientPointToLogical(clientPoint);
            DesignerEdges none        = DesignerEdges.None;

            if (this.designerToResize != null)
            {
                none = this.designerSizingEdge;
                this.UpdateDesignerSize(point, this.designerToResize, this.designerSizingEdge);
                flag = true;
            }
            else if (eventArgs.Button == MouseButtons.None)
            {
                ActivityDesigner designerToResize = this.GetDesignerToResize(point, out none);
                if (((designerToResize != null) && (none != DesignerEdges.None)) && this.CanResizeDesigner(designerToResize))
                {
                    flag = true;
                }
            }
            this.UpdateCursor(none);
            return(flag);
        }
 protected override void OnContainedActivitiesChanging(ActivityCollectionChangeEventArgs listChangeArgs)
 {
     base.OnContainedActivitiesChanging(listChangeArgs);
     if (listChangeArgs.Action == ActivityCollectionChangeAction.Remove)
     {
         FreeformActivityDesigner connectorContainer = ConnectionManager.GetConnectorContainer(this);
         List <Connector>         list = new List <Connector>();
         for (ActivityDesigner designer2 = this; designer2 != null; designer2 = designer2.ParentDesigner)
         {
             FreeformActivityDesigner designer3 = designer2 as FreeformActivityDesigner;
             if ((designer3 != null) && (designer3.Connectors.Count > 0))
             {
                 foreach (Activity activity in listChangeArgs.RemovedItems)
                 {
                     ActivityDesigner designer = ActivityDesigner.GetDesigner(activity);
                     if (!connectorContainer.MovingActivities.Contains(designer))
                     {
                         foreach (Connector connector in designer3.Connectors)
                         {
                             if ((designer == connector.Source.AssociatedDesigner) || (designer == connector.Target.AssociatedDesigner))
                             {
                                 list.Add(connector);
                             }
                         }
                     }
                 }
             }
         }
         foreach (Connector connector2 in list)
         {
             connector2.ParentDesigner.RemoveConnector(connector2);
             ((IDisposable)connector2).Dispose();
         }
     }
 }
        protected internal override PropertyInfo[] GetProperties(WorkflowMarkupSerializationManager serializationManager, object obj)
        {
            if (serializationManager == null)
            {
                throw new ArgumentNullException("serializationManager");
            }
            if (obj == null)
            {
                throw new ArgumentNullException("obj");
            }

            List <PropertyInfo> properties = new List <PropertyInfo>(base.GetProperties(serializationManager, obj));

            ActivityDesigner activityDesigner = obj as ActivityDesigner;

            if (activityDesigner != null)
            {
                PropertyInfo nameProperty = activityDesigner.GetType().GetProperty("Name", BindingFlags.Instance | BindingFlags.NonPublic);
                if (nameProperty != null)
                {
                    properties.Insert(0, nameProperty);
                }
            }

            return(properties.ToArray());
        }
        private bool IsRecursiveDropOperation(ActivityDesigner dropTargetDesigner)
        {
            if (dropTargetDesigner == null)
                return false;

            ISelectionService selectionService = (ISelectionService)GetService(typeof(ISelectionService));
            CompositeActivity dropTargetComponent = dropTargetDesigner.Activity as CompositeActivity;
            if (dropTargetComponent == null || selectionService == null)
                return false;

            // First check for activity designer specific recursion - possible recursion when drag-n-drop from outside the current 
            // designer such toolbox or other activity designers.
            WorkflowView workflowView = GetService(typeof(WorkflowView)) as WorkflowView;
            IDesignerHost host = GetService(typeof(IDesignerHost)) as IDesignerHost;
            WorkflowDesignerLoader loader = GetService(typeof(WorkflowDesignerLoader)) as WorkflowDesignerLoader;

            // When drag-n-drop within the same designer, if the drag drop is not within designer or no valid droptarget, we do not do anything
            if (this.draggedActivities.Count == 0 || this.existingDraggedActivities.Count == 0)
                return false;

            //Go thru all the components in dragged components and check for recursive dragdrop
            //Get all the top level activities being dragged dropped
            ArrayList topLevelActivities = new ArrayList(Helpers.GetTopLevelActivities(selectionService.GetSelectedComponents()));
            CompositeActivity parentActivity = dropTargetComponent;
            while (parentActivity != null)
            {
                if (topLevelActivities.Contains(parentActivity))
                    return true;

                parentActivity = parentActivity.Parent;
            }


            return false;
        }
Esempio n. 7
0
        protected override bool OnMouseDoubleClick(MouseEventArgs eventArgs)
        {
            ISelectionService selectionService = GetService(typeof(ISelectionService)) as ISelectionService;

            if (selectionService != null)
            {
                ArrayList selectedComponents = new ArrayList(selectionService.GetSelectedComponents());
                for (int i = 0; i < selectedComponents.Count; i++)
                {
                    Activity selectedComponent = selectedComponents[i] as Activity;
                    if (selectedComponent == null)
                    {
                        continue;
                    }

                    IDesigner designer = ActivityDesigner.GetDesigner(selectedComponent) as IDesigner;
                    if (designer != null)
                    {
                        designer.DoDefaultAction();
                        ((IWorkflowDesignerMessageSink)designer).OnMouseDoubleClick(eventArgs);
                        break;
                    }
                }
            }

            return(false);
        }
 internal static bool AreComponentsRemovable(ICollection components)
 {
     if (components == null)
     {
         throw new ArgumentNullException("components");
     }
     foreach (object obj2 in components)
     {
         Activity             activity = obj2 as Activity;
         ConnectorHitTestInfo info     = obj2 as ConnectorHitTestInfo;
         if ((activity == null) && (info == null))
         {
             return(false);
         }
         if (activity != null)
         {
             ActivityDesigner designer = ActivityDesigner.GetDesigner(activity);
             if ((designer != null) && designer.IsLocked)
             {
                 return(false);
             }
         }
         if ((info != null) && !(info.AssociatedDesigner is FreeformActivityDesigner))
         {
             return(false);
         }
     }
     return(true);
 }
        private void EnsureValidDesignerPreview(ActivityDesigner designer)
        {
            CompositeActivityDesigner designer2 = designer as CompositeActivityDesigner;

            if ((designer2 != null) && designer2.Expanded)
            {
                ActivityPreviewDesignerTheme designerTheme = this.parentDesigner.DesignerTheme as ActivityPreviewDesignerTheme;
                if (designerTheme != null)
                {
                    System.Drawing.Size previewWindowSize = designerTheme.PreviewWindowSize;
                    System.Drawing.Size size = designer2.Size;
                    float num = ((float)previewWindowSize.Width) / ((float)size.Width);
                    if (Math.Min(num, ((float)previewWindowSize.Height) / ((float)size.Height)) < 0.1f)
                    {
                        if (!designer2.CanExpandCollapse && (designer2.ContainedDesigners.Count > 0))
                        {
                            designer2 = designer2.ContainedDesigners[0] as CompositeActivityDesigner;
                        }
                        if (designer2 != null)
                        {
                            designer2.Expanded = false;
                        }
                    }
                }
            }
        }
        internal static Activity GetNextSelectableActivity(Activity currentActivity)
        {
            object                    obj2;
            ActivityDesigner          designer  = ActivityDesigner.GetDesigner(currentActivity);
            CompositeActivityDesigner designer2 = (designer != null) ? designer.ParentDesigner : null;

            if (designer2 == null)
            {
                return(null);
            }
            DesignerNavigationDirection direction = ((designer2 is ParallelActivityDesigner) || (designer2 is ActivityPreviewDesigner)) ? DesignerNavigationDirection.Right : DesignerNavigationDirection.Down;
            Activity activity = null;

            for (obj2 = designer2.GetNextSelectableObject(currentActivity, direction); ((activity == null) && (obj2 != null)) && (obj2 != currentActivity); obj2 = designer2.GetNextSelectableObject(obj2, direction))
            {
                activity = obj2 as Activity;
            }
            if (activity == null)
            {
                direction = ((designer2 is ParallelActivityDesigner) || (designer2 is ActivityPreviewDesigner)) ? DesignerNavigationDirection.Left : DesignerNavigationDirection.Up;
                for (obj2 = designer2.GetNextSelectableObject(currentActivity, direction); ((activity == null) && (obj2 != null)) && (obj2 != currentActivity); obj2 = designer2.GetNextSelectableObject(obj2, direction))
                {
                    activity = obj2 as Activity;
                }
            }
            if (activity == null)
            {
                activity = designer2.Activity;
            }
            return(activity);
        }
 internal static void ShowDesignerVerbs(ActivityDesigner designer, Point location, ICollection <DesignerVerb> designerVerbs)
 {
     if (!ShowingMenu && (designerVerbs.Count != 0))
     {
         IMenuCommandService service = designer.Activity.Site.GetService(typeof(IMenuCommandService)) as IMenuCommandService;
         if (service == null)
         {
             throw new Exception(SR.GetString("General_MissingService", new object[] { typeof(IMenuCommandService).FullName }));
         }
         try
         {
             foreach (DesignerVerb verb in designerVerbs)
             {
                 service.AddCommand(verb);
             }
             ShowingMenu = true;
             service.ShowContextMenu(WorkflowMenuCommands.DesignerActionsMenu, location.X - 2, location.Y + 1);
         }
         finally
         {
             ShowingMenu = false;
             foreach (DesignerVerb verb2 in designerVerbs)
             {
                 service.RemoveCommand(verb2);
             }
         }
     }
 }
        internal static bool DeserializeDesignerStates(IDesignerHost designerHost, BinaryReader reader)
        {
            int  num  = reader.ReadInt32();
            bool flag = num != designerHost.Container.Components.Count;

            for (int i = 0; i < num; i++)
            {
                string str  = reader.ReadString();
                int    num3 = reader.ReadInt32();
                if (designerHost.Container.Components[str] != null)
                {
                    ActivityDesigner designer = designerHost.GetDesigner(designerHost.Container.Components[str]) as ActivityDesigner;
                    if (designer != null)
                    {
                        ((IPersistUIState)designer).LoadViewState(reader);
                    }
                    else
                    {
                        flag = true;
                        Stream baseStream = reader.BaseStream;
                        baseStream.Position += num3;
                    }
                }
                else
                {
                    flag = true;
                    Stream stream2 = reader.BaseStream;
                    stream2.Position += num3;
                }
            }
            return(flag);
        }
Esempio n. 13
0
 public override void OnActivate()
 {
     if (this.AssociatedDesigner == null)
     {
         Type type = base.UserData[UserDataKey_ActivityType] as Type;
         CompositeActivity activity = this.parentDesigner.Activity as CompositeActivity;
         if (((type != null) && (activity != null)) && this.parentDesigner.IsEditable)
         {
             Activity activity2 = Activator.CreateInstance(type) as Activity;
             try
             {
                 CompositeActivityDesigner.InsertActivities(this.parentDesigner, new System.Workflow.ComponentModel.Design.HitTestInfo(this.parentDesigner, HitTestLocations.Designer), new List <Activity>(new Activity[] { activity2 }).AsReadOnly(), SR.GetString("AddingImplicitActivity"));
             }
             catch (Exception exception)
             {
                 if (exception != CheckoutException.Canceled)
                 {
                     IUIService service = this.parentDesigner.Activity.Site.GetService(typeof(IUIService)) as IUIService;
                     if (service != null)
                     {
                         service.ShowError(exception.Message);
                     }
                 }
             }
             ActivityDesigner designer = ActivityDesigner.GetDesigner(activity2);
             base.UserData[UserDataKey_Designer] = designer;
         }
     }
 }
Esempio n. 14
0
        protected override void OnViewChanged(DesignerView view)
        {
            base.OnViewChanged(view);
            ActivityDesigner designer = (base.ActiveView != null) ? base.ActiveView.AssociatedDesigner : null;

            if (designer.Activity is FaultHandlersActivity)
            {
                this.Header.Text = System.Workflow.Activities.DR.GetString("WorkflowExceptions");
                this.HelpText    = string.Empty;
            }
            else if (designer.Activity is EventHandlersActivity)
            {
                this.Header.Text = System.Workflow.Activities.DR.GetString("WorkflowEvents");
                this.HelpText    = string.Empty;
            }
            else if (designer.Activity is CompensationHandlerActivity)
            {
                this.Header.Text = System.Workflow.Activities.DR.GetString("WorkflowCompensation");
                this.HelpText    = string.Empty;
            }
            else if (designer.Activity is CancellationHandlerActivity)
            {
                this.Header.Text = System.Workflow.Activities.DR.GetString("WorkflowCancellation");
                this.HelpText    = string.Empty;
            }
            else
            {
                this.Header.Text = System.Workflow.Activities.DR.GetString("StartSequentialWorkflow");
                this.HelpText    = System.Workflow.Activities.DR.GetString("SequentialWorkflowHelpText");
            }
        }
Esempio n. 15
0
        protected override bool OnMouseUp(MouseEventArgs eventArgs)
        {
            Point clientPoint = new Point(eventArgs.X, eventArgs.Y);

            if (!base.ParentView.IsClientPointInActiveLayout(clientPoint))
            {
                if (this.currentActiveDesigner != null)
                {
                    ((IWorkflowDesignerMessageSink)this.currentActiveDesigner).OnMouseLeave();
                }
                this.currentActiveDesigner = null;
                return(true);
            }
            System.Workflow.ComponentModel.Design.HitTestInfo messageHitTestContext = base.MessageHitTestContext;
            if (this.currentActiveDesigner != messageHitTestContext.AssociatedDesigner)
            {
                if (this.currentActiveDesigner != null)
                {
                    ((IWorkflowDesignerMessageSink)this.currentActiveDesigner).OnMouseLeave();
                }
                this.currentActiveDesigner = messageHitTestContext.AssociatedDesigner;
                if (this.currentActiveDesigner != null)
                {
                    ((IWorkflowDesignerMessageSink)this.currentActiveDesigner).OnMouseEnter(eventArgs);
                }
            }
            if (this.currentActiveDesigner != null)
            {
                ((IWorkflowDesignerMessageSink)this.currentActiveDesigner).OnMouseUp(eventArgs);
            }
            return(false);
        }
Esempio n. 16
0
 public override void Select(AccessibleSelection flags)
 {
     if (this.accessibleObjectType == AccessibleObjectType.Item)
     {
         ISelectionService service            = this.GetService(typeof(ISelectionService)) as ISelectionService;
         ActivityDesigner  associatedDesigner = this.AssociatedDesigner;
         if ((service != null) && (associatedDesigner != null))
         {
             if (((flags & AccessibleSelection.TakeFocus) > AccessibleSelection.None) || ((flags & AccessibleSelection.TakeSelection) > AccessibleSelection.None))
             {
                 service.SetSelectedComponents(new object[] { associatedDesigner.Activity }, SelectionTypes.Replace);
             }
             else if ((flags & AccessibleSelection.AddSelection) > AccessibleSelection.None)
             {
                 service.SetSelectedComponents(new object[] { associatedDesigner.Activity }, SelectionTypes.Add);
             }
             else if ((flags & AccessibleSelection.RemoveSelection) > AccessibleSelection.None)
             {
                 service.SetSelectedComponents(new object[] { associatedDesigner.Activity }, SelectionTypes.Remove);
             }
         }
     }
     else
     {
         base.Select(flags);
     }
 }
Esempio n. 17
0
        protected override void OnLayoutPosition(ActivityDesignerLayoutEventArgs e)
        {
            if (e == null)
            {
                throw new ArgumentNullException("e");
            }

            base.OnLayoutPosition(e);

            if (Expanded)
            {
                ActivityDesigner activeDesigner = ActiveDesigner;
                if (activeDesigner != null && activeDesigner != this)
                {
                    Point location = Location;
                    location.X += (Size.Width - activeDesigner.Size.Width) / 2;
                    location.Y += e.AmbientTheme.SelectionSize.Height;
                    activeDesigner.Location = location;
                }

                int titleHeight = TitleHeight;
                foreach (ActivityDesigner activityDesigner in ContainedDesigners)
                {
                    activityDesigner.Location = new Point(activityDesigner.Location.X, activityDesigner.Location.Y + titleHeight);
                }
            }
        }
Esempio n. 18
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);
        }
        public static Point[] Route(IServiceProvider serviceProvider, object source, object target, ICollection <Rectangle> userDefinedRoutingObstacles)
        {
            List <Rectangle> list;
            List <Point>     list2;
            List <Point>     list3;

            GetRoutingObstacles(serviceProvider, source, target, out list, out list2, out list3);
            if (userDefinedRoutingObstacles != null)
            {
                list.AddRange(userDefinedRoutingObstacles);
            }
            ActivityDesigner safeRootDesigner = ActivityDesigner.GetSafeRootDesigner(serviceProvider);
            AmbientTheme     ambientTheme     = WorkflowTheme.CurrentTheme.AmbientTheme;
            Point            begin            = (source is ConnectionPoint) ? ((ConnectionPoint)source).Location : ((Point)source);
            Point            end = (target is ConnectionPoint) ? ((ConnectionPoint)target).Location : ((Point)target);

            Point[] segments = ConnectorRouter.Route(begin, end, new Size(2 * ambientTheme.Margin.Width, 2 * ambientTheme.Margin.Height), safeRootDesigner.Bounds, list.ToArray(), list2.ToArray(), list3.ToArray());
            if (!AreAllSegmentsVerticalOrHorizontal(segments))
            {
                segments = ConnectorRouter.Route(begin, end, ambientTheme.Margin, safeRootDesigner.Bounds, new Rectangle[0], list2.ToArray(), new Point[0]);
            }
            if (!AreAllSegmentsVerticalOrHorizontal(segments))
            {
                Point point3 = (DesignerGeometryHelper.SlopeOfLineSegment(begin, end) < 1f) ? new Point(end.X, begin.Y) : new Point(begin.X, end.Y);
                segments = new Point[] { begin, point3, end };
            }
            return(segments);
        }
        // The above suppression is required because, the parentDesigner object is changeing inside the loop and it is
        // not possible to cache the result of the cast as suggested by FxCop
        private static bool IsInsidePreviewDesignerBranch(ActivityDesigner activityDesigner, out bool visible)
        {
            visible = false;
            ActivityDesigner currentDesigner = activityDesigner;
            ActivityDesigner parentDesigner  = activityDesigner.ParentDesigner;

            while (!currentDesigner.IsRootDesigner)
            {
                if (parentDesigner is ActivityPreviewDesigner)
                {
                    break;
                }
                else
                {
                    currentDesigner = parentDesigner;
                    parentDesigner  = parentDesigner.ParentDesigner;
                }
            }
            if (parentDesigner is ActivityPreviewDesigner)
            {
                if (((ActivityPreviewDesigner)parentDesigner).IsContainedDesignerVisible(currentDesigner))
                {
                    visible = true;
                }
                return(true);
            }
            return(false);
        }
        public override void MoveActivities(System.Workflow.ComponentModel.Design.HitTestInfo moveLocation, ReadOnlyCollection <Activity> activitiesToMove)
        {
            if (moveLocation == null)
            {
                throw new ArgumentNullException("moveLocation");
            }
            if (activitiesToMove == null)
            {
                throw new ArgumentNullException("activitiesToMove");
            }
            FreeformActivityDesigner connectorContainer = ConnectionManager.GetConnectorContainer(this);

            try
            {
                connectorContainer.MovingActivities.Clear();
                if ((connectorContainer != null) && (connectorContainer.Connectors.Count > 0))
                {
                    foreach (Activity activity in activitiesToMove)
                    {
                        ActivityDesigner designer = ActivityDesigner.GetDesigner(activity);
                        if (ConnectionManager.GetConnectorContainer(designer) == connectorContainer)
                        {
                            connectorContainer.MovingActivities.Add(designer);
                        }
                    }
                }
                base.MoveActivities(moveLocation, activitiesToMove);
            }
            finally
            {
                connectorContainer.MovingActivities.Clear();
            }
        }
Esempio n. 22
0
        protected override Rectangle[] GetDropTargets(Point dropPoint)
        {
            if (!this.Expanded || (base.ActiveDesigner != this))
            {
                return(new Rectangle[0]);
            }
            CompositeDesignerTheme designerTheme = base.DesignerTheme as CompositeDesignerTheme;
            Rectangle bounds = base.Bounds;
            ReadOnlyCollection <ActivityDesigner> containedDesigners = this.ContainedDesigners;

            Rectangle[] rectangleArray = new Rectangle[containedDesigners.Count + 1];
            if (containedDesigners.Count > 0)
            {
                ActivityDesigner designer = containedDesigners[0];
                rectangleArray[0].Location = new Point(bounds.X, designer.Location.Y);
                rectangleArray[0].Size     = new Size((designerTheme != null) ? designerTheme.ConnectorSize.Width : 0, designer.Size.Height);
                for (int i = 0; i < (containedDesigners.Count - 1); i++)
                {
                    ActivityDesigner designer2  = containedDesigners[i];
                    Rectangle        rectangle2 = designer2.Bounds;
                    ActivityDesigner designer3  = containedDesigners[i + 1];
                    Rectangle        rectangle3 = designer3.Bounds;
                    rectangleArray[i + 1].Location = new Point((rectangle2.Right + ((rectangle3.Left - rectangle2.Right) / 2)) - (((designerTheme != null) ? designerTheme.ConnectorSize.Width : 0) / 2), rectangle2.Top);
                    rectangleArray[i + 1].Size     = new Size((designerTheme != null) ? designerTheme.ConnectorSize.Width : 0, rectangle2.Height);
                }
                ActivityDesigner designer4 = containedDesigners[containedDesigners.Count - 1];
                rectangleArray[containedDesigners.Count].Location = new Point(bounds.Right - ((designerTheme != null) ? designerTheme.ConnectorSize.Width : 0), designer4.Location.Y);
                rectangleArray[containedDesigners.Count].Size     = new Size((designerTheme != null) ? designerTheme.ConnectorSize.Width : 0, designer4.Size.Height);
                return(rectangleArray);
            }
            rectangleArray[0].Location = new Point(this.Location.X + ((this.Size.Width - ((designerTheme != null) ? designerTheme.ConnectorSize.Width : 0)) / 2), this.TextRectangle.Bottom);
            rectangleArray[0].Size     = new Size((designerTheme != null) ? designerTheme.ConnectorSize.Width : 0, (this.Location.Y + this.Size.Height) - rectangleArray[0].Location.Y);
            return(rectangleArray);
        }
Esempio n. 23
0
 public override System.Workflow.ComponentModel.Design.HitTestInfo HitTest(Point point)
 {
     System.Workflow.ComponentModel.Design.HitTestInfo nowhere = System.Workflow.ComponentModel.Design.HitTestInfo.Nowhere;
     if (this.Expanded && (base.ActiveDesigner == this))
     {
         if ((this.ContainedDesigners.Count == 0) && this.HelpTextRectangle.Contains(point))
         {
             return(new ConnectorHitTestInfo(this, HitTestLocations.Designer, 0));
         }
         if (this.previewStrip.Bounds.Contains(point))
         {
             System.Workflow.ComponentModel.Design.ItemInfo info2 = this.previewStrip.HitTest(point);
             ActivityDesigner designer = (info2 != null) ? ActivityDesigner.GetDesigner(info2.UserData[DesignerUserDataKeys.Activity] as Activity) : null;
             if (designer != null)
             {
                 return(new System.Workflow.ComponentModel.Design.HitTestInfo(designer, HitTestLocations.Designer));
             }
             return(new System.Workflow.ComponentModel.Design.HitTestInfo(this, HitTestLocations.ActionArea | HitTestLocations.Designer));
         }
         if ((this.ShowPreview && this.previewWindow.Bounds.Contains(point)) && ((this.previewWindow.PreviewMode || (this.PreviewedDesigner == null)) || !this.PreviewedDesigner.Bounds.Contains(point)))
         {
             return(new System.Workflow.ComponentModel.Design.HitTestInfo(this, HitTestLocations.ActionArea | HitTestLocations.Designer));
         }
         nowhere = base.HitTest(point);
         if ((this.ShowPreview && this.previewWindow.PreviewMode) && (nowhere.AssociatedDesigner != this))
         {
             nowhere = System.Workflow.ComponentModel.Design.HitTestInfo.Nowhere;
         }
         return(nowhere);
     }
     return(base.HitTest(point));
 }
Esempio n. 24
0
        public override object GetNextSelectableObject(object obj, DesignerNavigationDirection direction)
        {
            if (base.ActiveDesigner != this)
            {
                return(base.GetNextSelectableObject(obj, direction));
            }
            if ((direction != DesignerNavigationDirection.Left) && (direction != DesignerNavigationDirection.Right))
            {
                return(null);
            }
            object activity = null;
            ReadOnlyCollection <ActivityDesigner> containedDesigners = this.ContainedDesigners;
            ActivityDesigner designer = ActivityDesigner.GetDesigner(obj as Activity);
            int num = (designer != null) ? containedDesigners.IndexOf(designer) : -1;

            if (((direction == DesignerNavigationDirection.Left) && (num >= 0)) && (num < containedDesigners.Count))
            {
                return(containedDesigners[(num > 0) ? (num - 1) : (containedDesigners.Count - 1)].Activity);
            }
            if ((direction == DesignerNavigationDirection.Right) && (num <= (containedDesigners.Count - 1)))
            {
                activity = containedDesigners[(num < (containedDesigners.Count - 1)) ? (num + 1) : 0].Activity;
            }
            return(activity);
        }
        protected override void OnViewChanged(DesignerView view)
        {
            base.OnViewChanged(view);

            ActivityDesigner hostedDesigner = (ActiveView != null) ? ActiveView.AssociatedDesigner : null;

            if (hostedDesigner.Activity is FaultHandlersActivity)
            {
                Header.Text = DR.GetString(DR.WorkflowExceptions);
                HelpText    = String.Empty;
            }
            else if (hostedDesigner.Activity is EventHandlersActivity)
            {
                Header.Text = DR.GetString(DR.WorkflowEvents);
                HelpText    = String.Empty;
            }
            else if (hostedDesigner.Activity is CompensationHandlerActivity)
            {
                Header.Text = DR.GetString(DR.WorkflowCompensation);
                HelpText    = String.Empty;
            }
            else if (hostedDesigner.Activity is CancellationHandlerActivity)
            {
                Header.Text = DR.GetString(DR.WorkflowCancellation);
                HelpText    = String.Empty;
            }
            else
            {
                Header.Text = DR.GetString(DR.StartSequentialWorkflow);
                HelpText    = DR.GetString(DR.SequentialWorkflowHelpText);
            }
        }
        public override bool CanInsertActivities(System.Workflow.ComponentModel.Design.HitTestInfo insertLocation, ReadOnlyCollection <Activity> activitiesToInsert)
        {
            if (insertLocation == null)
            {
                throw new ArgumentNullException("insertLocation");
            }
            if (activitiesToInsert == null)
            {
                throw new ArgumentNullException("activitiesToInsert");
            }
            ActivityDesigner designer = (this.ActiveView != null) ? this.ActiveView.AssociatedDesigner : null;

            if (designer != this)
            {
                return(false);
            }
            IList <System.Type> activityTypes = SecondaryViewProvider.GetActivityTypes(this);

            foreach (Activity activity in activitiesToInsert)
            {
                if (activity == null)
                {
                    throw new ArgumentException("activitiesToInsert", SR.GetString("Error_CollectionHasNullEntry"));
                }
                if (activityTypes.Contains(activity.GetType()))
                {
                    return(false);
                }
            }
            return(base.CanInsertActivities(this.GetUpdatedLocation(insertLocation), activitiesToInsert));
        }
Esempio n. 27
0
 public BottomVisualsAdornerWrapper(UIElement target, FrameworkElement adornerContent, ActivityDesigner activityDesigner)
     : base(target)
 {
     _activity       = activityDesigner;
     _visualChildren = new VisualCollection(this);
     _visualChildren.Add(adornerContent);
 }
        public override object GetNextSelectableObject(object obj, DesignerNavigationDirection direction)
        {
            if (ActiveDesigner != this)
            {
                return(base.GetNextSelectableObject(obj, direction));
            }

            if (direction != DesignerNavigationDirection.Left && direction != DesignerNavigationDirection.Right)
            {
                return(null);
            }

            object nextObject = null;

            ReadOnlyCollection <ActivityDesigner> containedDesigners = ContainedDesigners;
            ActivityDesigner activityDesigner = ActivityDesigner.GetDesigner(obj as Activity);
            int index = (activityDesigner != null) ? containedDesigners.IndexOf(activityDesigner) : -1;

            if (direction == DesignerNavigationDirection.Left && index >= 0 && index < containedDesigners.Count)
            {
                nextObject = ((ActivityDesigner)containedDesigners[(index > 0) ? index - 1 : containedDesigners.Count - 1]).Activity;
            }
            else if (direction == DesignerNavigationDirection.Right && index <= containedDesigners.Count - 1)
            {
                nextObject = ((ActivityDesigner)containedDesigners[(index < containedDesigners.Count - 1) ? index + 1 : 0]).Activity;
            }

            return(nextObject);
        }
Esempio n. 29
0
        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);
        }
Esempio n. 30
0
 protected virtual void OnRefreshNode(WorkflowOutlineNode node)
 {
     if (node != null)
     {
         Activity activity = node.Activity;
         if (activity != null)
         {
             int num = (this.treeView.ImageList != null) ? this.treeView.ImageList.Images.IndexOfKey(activity.GetType().FullName) : -1;
             if (num == -1)
             {
                 ActivityDesigner designer = ActivityDesigner.GetDesigner(activity);
                 if (designer != null)
                 {
                     Bitmap stockImage = designer.StockImage as Bitmap;
                     if (stockImage != null)
                     {
                         if (this.treeView.ImageList == null)
                         {
                             this.treeView.ImageList            = new ImageList();
                             this.treeView.ImageList.ColorDepth = ColorDepth.Depth32Bit;
                         }
                         this.treeView.ImageList.Images.Add(activity.GetType().FullName, stockImage);
                         num = this.treeView.ImageList.Images.Count - 1;
                     }
                 }
             }
             node.ImageIndex = node.SelectedImageIndex = num;
             node.RefreshNode();
         }
     }
 }