internal static Connector GetConnectorFromSelectedObject(object selectedObject)
        {
            Connector            connector = null;
            ConnectorHitTestInfo info      = selectedObject as ConnectorHitTestInfo;

            if (info != null)
            {
                FreeformActivityDesigner associatedDesigner = info.AssociatedDesigner as FreeformActivityDesigner;
                int num = info.MapToIndex();
                if (((associatedDesigner != null) && (num >= 0)) && (num < associatedDesigner.Connectors.Count))
                {
                    connector = associatedDesigner.Connectors[num];
                }
            }
            return(connector);
        }
예제 #2
0
        public override bool Equals(object obj)
        {
            ConnectorHitTestInfo destinationConnector = obj as ConnectorHitTestInfo;

            if (destinationConnector != null)
            {
                if (destinationConnector.AssociatedDesigner == AssociatedDesigner &&
                    destinationConnector.HitLocation == HitLocation &&
                    destinationConnector.MapToIndex() == MapToIndex())
                {
                    return(true);
                }
            }

            return(false);
        }
예제 #3
0
            public override AccessibleObject Navigate(AccessibleNavigation navdir)
            {
                if (navdir == AccessibleNavigation.FirstChild || navdir == AccessibleNavigation.LastChild)
                {
                    return(base.Navigate(navdir));
                }

                DesignerNavigationDirection navigate = default(DesignerNavigationDirection);

                if (navdir == AccessibleNavigation.Left)
                {
                    navigate = DesignerNavigationDirection.Left;
                }
                else if (navdir == AccessibleNavigation.Right)
                {
                    navigate = DesignerNavigationDirection.Right;
                }
                else if (navdir == AccessibleNavigation.Up || navdir == AccessibleNavigation.Previous)
                {
                    navigate = DesignerNavigationDirection.Up;
                }
                else if (navdir == AccessibleNavigation.Down || navdir == AccessibleNavigation.Next)
                {
                    navigate = DesignerNavigationDirection.Down;
                }

                object nextSelectableObj = ((CompositeActivityDesigner)this.connectorHitInfo.AssociatedDesigner).GetNextSelectableObject(this.connectorHitInfo, navigate);

                if (nextSelectableObj is ConnectorHitTestInfo)
                {
                    ConnectorHitTestInfo nextConnector = nextSelectableObj as ConnectorHitTestInfo;
                    return(new SequentialConnectorAccessibleObject(nextConnector.AssociatedDesigner as SequentialActivityDesigner, nextConnector.MapToIndex()));
                }
                else if (nextSelectableObj is Activity)
                {
                    ActivityDesigner activityDesigner = ActivityDesigner.GetDesigner(nextSelectableObj as Activity);
                    if (activityDesigner != null)
                    {
                        return(activityDesigner.AccessibilityObject);
                    }
                }

                return(base.Navigate(navdir));
            }
        protected override void OnKeyDown(KeyEventArgs e)
        {
            if (e == null)
            {
                throw new ArgumentNullException("e");
            }
            ISelectionService service = base.GetService(typeof(ISelectionService)) as ISelectionService;

            if (((service != null) ? service.PrimarySelection : null) != null)
            {
                List <Activity> list = new List <Activity>(Helpers.GetTopLevelActivities(service.GetSelectedComponents()));
                if (((e.KeyCode == Keys.Left) || (e.KeyCode == Keys.Right)) || ((e.KeyCode == Keys.Up) || (e.KeyCode == Keys.Down)))
                {
                    Size empty = Size.Empty;
                    if (e.KeyCode == Keys.Left)
                    {
                        empty = new Size(-5, 0);
                    }
                    else if (e.KeyCode == Keys.Right)
                    {
                        empty = new Size(5, 0);
                    }
                    else if (e.KeyCode == Keys.Up)
                    {
                        empty = new Size(0, -5);
                    }
                    else if (e.KeyCode == Keys.Down)
                    {
                        empty = new Size(0, 5);
                    }
                    foreach (Activity activity in list)
                    {
                        ActivityDesigner designer = ActivityDesigner.GetDesigner(activity);
                        if (designer != null)
                        {
                            base.ParentView.InvalidateClientRectangle(new Rectangle(designer.Location, designer.Size));
                            designer.Location += empty;
                            base.ParentView.InvalidateClientRectangle(new Rectangle(designer.Location, designer.Size));
                        }
                    }
                    base.PerformLayout();
                    e.Handled = true;
                }
                else if (e.KeyCode == Keys.Delete)
                {
                    foreach (object obj3 in service.GetSelectedComponents())
                    {
                        ConnectorHitTestInfo info = obj3 as ConnectorHitTestInfo;
                        if (info != null)
                        {
                            FreeformActivityDesigner associatedDesigner = info.AssociatedDesigner as FreeformActivityDesigner;
                            if (associatedDesigner != null)
                            {
                                ReadOnlyCollection <Connector> connectors = associatedDesigner.Connectors;
                                int num = info.MapToIndex();
                                if (num < connectors.Count)
                                {
                                    service.SetSelectedComponents(new object[] { info }, SelectionTypes.Remove);
                                    associatedDesigner.RemoveConnector(connectors[num]);
                                    object obj4 = associatedDesigner;
                                    if (connectors.Count > 0)
                                    {
                                        obj4 = new ConnectorHitTestInfo(associatedDesigner, HitTestLocations.Connector | HitTestLocations.Designer, (num > 0) ? (num - 1) : num);
                                    }
                                    service.SetSelectedComponents(new object[] { obj4 }, SelectionTypes.Replace);
                                }
                            }
                        }
                    }
                    e.Handled = true;
                }
                if (!e.Handled)
                {
                    base.OnKeyDown(e);
                }
            }
        }
        public override bool Equals(object obj)
        {
            ConnectorHitTestInfo info = obj as ConnectorHitTestInfo;

            return(((info != null) && (info.AssociatedDesigner == base.AssociatedDesigner)) && ((info.HitLocation == base.HitLocation) && (info.MapToIndex() == this.MapToIndex())));
        }
예제 #6
0
 public override AccessibleObject Navigate(AccessibleNavigation navdir)
 {
     if ((navdir != AccessibleNavigation.FirstChild) && (navdir != AccessibleNavigation.LastChild))
     {
         DesignerNavigationDirection down = DesignerNavigationDirection.Down;
         if (navdir == AccessibleNavigation.Left)
         {
             down = DesignerNavigationDirection.Left;
         }
         else if (navdir == AccessibleNavigation.Right)
         {
             down = DesignerNavigationDirection.Right;
         }
         else if ((navdir == AccessibleNavigation.Up) || (navdir == AccessibleNavigation.Previous))
         {
             down = DesignerNavigationDirection.Up;
         }
         else if ((navdir == AccessibleNavigation.Down) || (navdir == AccessibleNavigation.Next))
         {
             down = DesignerNavigationDirection.Down;
         }
         object nextSelectableObject = ((CompositeActivityDesigner)this.connectorHitInfo.AssociatedDesigner).GetNextSelectableObject(this.connectorHitInfo, down);
         if (nextSelectableObject is ConnectorHitTestInfo)
         {
             ConnectorHitTestInfo info = nextSelectableObject as ConnectorHitTestInfo;
             return(new SequenceDesignerAccessibleObject.SequentialConnectorAccessibleObject(info.AssociatedDesigner as SequentialActivityDesigner, info.MapToIndex()));
         }
         if (nextSelectableObject is Activity)
         {
             ActivityDesigner designer = ActivityDesigner.GetDesigner(nextSelectableObject as Activity);
             if (designer != null)
             {
                 return(designer.AccessibilityObject);
             }
         }
     }
     return(base.Navigate(navdir));
 }