private void OnSelectionChanged(object sender, EventArgs e)
 {
     if ((base.Component != null) && (this.menuItem != null))
     {
         ISelectionService selectionService = (ISelectionService)sender;
         if (selectionService.GetComponentSelected(this.menuItem))
         {
             selectionService.SetSelectedComponents(new IComponent[] { base.Component }, SelectionTypes.Replace);
         }
         if ((!base.Component.Equals(selectionService.PrimarySelection) || !this.selected) && (this.IsContextMenuStripItemSelected(selectionService) || base.Component.Equals(selectionService.PrimarySelection)))
         {
             if (!this.dropDown.Visible)
             {
                 this.ShowMenu();
             }
             SelectionManager service = (SelectionManager)this.GetService(typeof(SelectionManager));
             if (service != null)
             {
                 if (this.dummyToolStripGlyph != null)
                 {
                     service.BodyGlyphAdorner.Glyphs.Insert(0, this.dummyToolStripGlyph);
                 }
                 this.AddSelectionGlyphs(service, selectionService);
             }
         }
     }
 }
 private void OnNewSelection(object sender, EventArgs e)
 {
     if (base.DesignMode)
     {
         ISelectionService selectionService = ActiveXHelper.GetSelectionService(this);
         if (selectionService != null)
         {
             if (!selectionService.GetComponentSelected(this))
             {
                 if (this.activeXEditMode != ActiveXHelper.ActiveXEditMode.None)
                 {
                     this.GetParentContainer().OnExitEditMode(this);
                     this.SetEditMode(ActiveXHelper.ActiveXEditMode.None);
                 }
                 this.SetSelectionStyle(ActiveXHelper.SelectionStyle.Selected);
                 this.RemoveSelectionHandler();
             }
             else
             {
                 PropertyDescriptor propertyDescriptor = TypeDescriptor.GetProperties(this)["SelectionStyle"];
                 if ((propertyDescriptor != null) && (propertyDescriptor.PropertyType == typeof(int)))
                 {
                     int selectionStyle = (int)propertyDescriptor.GetValue(this);
                     if (((ActiveXHelper.SelectionStyle)selectionStyle) != this.selectionStyle)
                     {
                         propertyDescriptor.SetValue(this, this.selectionStyle);
                     }
                 }
             }
         }
     }
 }
示例#3
0
  void service_SelectionChanged(object sender, EventArgs e)
  {
    ISelectionService service = (ISelectionService)GetService(typeof(ISelectionService));
    isSelected = service != null && service.GetComponentSelected(Control);

    if(service != null)
    {
      // when the wizard is reloaded, it goes back to the first step. but the user may have been working on another
      // step. so if any controls are selected that belong to a different step, switch to that step
      Wizard wizard = GetWizard();
      if(wizard != null && wizard.CurrentStepIndex == 0)
      {
        foreach(IComponent selected in service.GetSelectedComponents())
        {
          Control control = selected as Control;
          if(control != null)
          {
            WizardStep step = null;
            do
            {
              step    = control as WizardStep;
              control = control.Parent;
            } while(step == null && control != null);

            if(step != null && step.Wizard == wizard)
            {
              wizard.CurrentStep = step;
              break;
            }
          }
        }
      }
    }
  }
示例#4
0
        private void InitiateDragDrop()
        {
            WorkflowView      parentView       = ParentView;
            ISelectionService selectionService = (ISelectionService)GetService(typeof(ISelectionService));
            IDesignerHost     designerHost     = (IDesignerHost)GetService(typeof(IDesignerHost));

            if (selectionService == null || designerHost == null)
            {
                return;
            }

            // check if we are cutting root component
            ICollection components = selectionService.GetSelectedComponents();

            if (components == null || components.Count < 1 || selectionService.GetComponentSelected(designerHost.RootComponent) || !Helpers.AreAllActivities(components))
            {
                return;
            }

            DragDropEffects effects = DragDropEffects.None;

            try
            {
                // get component serialization service
                this.existingDraggedActivities.AddRange(Helpers.GetTopLevelActivities(components));

                //IMPORTANT: FOR WITHIN DESIGNER COMPONENT MOVE WE REMOVE THE ACTIVITIES BEFORE WE ADD THEM WHICH IS IN
                //ONDRAGDROP FUNCTION. ALTHOUGH THIS VIOLATES THE DODRAGDROP FUNCTION SIMANTICS, WE NEED TO DO THIS
                //SO THAT WE CAN USE THE SAME IDS FOR THE ACTIVITIES
                DragDropEffects allowedEffects = (DesignerHelpers.AreAssociatedDesignersMovable(this.existingDraggedActivities)) ? DragDropEffects.Move | DragDropEffects.Copy : DragDropEffects.Copy;
                IDataObject     dataObject     = CompositeActivityDesigner.SerializeActivitiesToDataObject(ParentView, this.existingDraggedActivities.ToArray());
                effects = parentView.DoDragDrop(dataObject, allowedEffects);

                //
            }
            catch (Exception e)
            {
                DesignerHelpers.ShowError(ParentView, e.Message);
            }
            finally
            {
                //This means drag drop occurred across designer
                if (effects == DragDropEffects.Move && this.existingDraggedActivities.Count > 0)
                {
                    string transactionDescription = String.Empty;
                    if (this.existingDraggedActivities.Count > 1)
                    {
                        transactionDescription = SR.GetString(SR.MoveMultipleActivities, this.existingDraggedActivities.Count);
                    }
                    else
                    {
                        transactionDescription = SR.GetString(SR.MoveSingleActivity, this.existingDraggedActivities[0].GetType());
                    }

                    CompositeActivityDesigner.RemoveActivities(ParentView, this.existingDraggedActivities.AsReadOnly(), transactionDescription);
                }

                this.existingDraggedActivities.Clear();
            }
        }
 private void OnSelectionChanging(object sender, EventArgs e)
 {
     if (selectionService.GetComponentSelected(pnlContent))
     {
         selectionService.SelectionChanging -= OnSelectionChanging;
         selectionService.SetSelectedComponents(new[] { pnlContent }, SelectionTypes.Remove);
         selectionService.SelectionChanging += OnSelectionChanging;
     }
 }
示例#6
0
        public void Remove(System.ComponentModel.IComponent component)
        {
            //safety checks
            if (component == null)
            {
                throw new ArgumentNullException("component");
            }
            if (component.Site == null || component.Site.Container != this)
            {
                throw new ArgumentException("Component is not sited in this container");
            }

            //broadcast start of removal process
            OnComponentRemoving(component);

            //clean up component and designer
            components.Remove(component);
            IDesigner designer = GetDesigner(component);

            if (designer != null)
            {
                designers.Remove(component);
                designer.Dispose();
            }
            component.Site = null;

            //if someone tries to kill root component, must destroy all children too
            if (component == host.RootComponent)
            {
                //clean everything up
                foreach (System.Web.UI.Control control in Components)
                {
                    host.DestroyComponent(control);
                }
                host.SetRootComponent(null);
                host.Reset();
            }

            //TODO: remove references from referenceManager

            //clean up selection service
            ISelectionService sel = (ISelectionService)this.GetService(typeof(ISelectionService));

            if (sel != null && sel.GetComponentSelected(component))
            {
                sel.SetSelectedComponents(new IComponent[] {});
            }

            //broadcast completion of removal process
            OnComponentRemoved(component);
        }
        private bool CanInitiateDragDrop()
        {
            //Go thru all the selected components and make sure that they can participate in drag drop
            ISelectionService selectionService = (ISelectionService)GetService(typeof(ISelectionService));
            IDesignerHost designerHost = (IDesignerHost)GetService(typeof(IDesignerHost));
            if (selectionService == null || designerHost == null)
                return false;

            // check if we are cutting root component
            ICollection components = selectionService.GetSelectedComponents();
            if (components == null || components.Count < 1 || selectionService.GetComponentSelected(designerHost.RootComponent) || !Helpers.AreAllActivities(components))
                return false;

            return true;
        }
        protected override bool GetHitTest(System.Drawing.Point point)
        {
            ISelectionService selection = (ISelectionService)this.GetService(typeof(ISelectionService));

            if (selection != null && selection.SelectionCount == 1 && selection.GetComponentSelected(this.Component))
            {
                HorizontalTabs tabs = this.Component as HorizontalTabs;
                if (tabs != null)
                {
                    point = tabs.PointToClient(point);
                    return(tabs.GetTabOnPoint(point) != null);
                }
            }
            return(base.GetHitTest(point));
        }
示例#9
0
        protected override void OnPaintAdornments(PaintEventArgs pe)
        {
            BaseLineItem label = (BaseLineItem)Control;

            if (selectionService != null)
            {
                if (selectionService.GetComponentSelected(label))
                {
                    // Paint grab handles.
                    Rectangle grapRectangle = GetHandle(label.FromPoint);
                    ControlPaint.DrawGrabHandle(pe.Graphics, grapRectangle, true, true);
                    grapRectangle = GetHandle(label.ToPoint);
                    ControlPaint.DrawGrabHandle(pe.Graphics, grapRectangle, true, true);
                }
            }
        }
示例#10
0
        protected override void OnClick(EventArgs e)
        {
            if (GetSite() != null && !(this.ElementTree.Control is RadMenu))
            {
                ISelectionService service = this.Site.GetService(typeof(ISelectionService)) as ISelectionService;

                if (service != null && !service.GetComponentSelected(this))
                {
                    service.SetSelectedComponents(new IComponent[] { this });
                }
            }
            else
            {
                base.OnClick(e);
            }
        }
 private void SetSelectionStyle(ActiveXHelper.SelectionStyle selectionStyle)
 {
     if (base.DesignMode)
     {
         ISelectionService selectionService = ActiveXHelper.GetSelectionService(this);
         this.selectionStyle = selectionStyle;
         if ((selectionService != null) && selectionService.GetComponentSelected(this))
         {
             PropertyDescriptor propertyDescriptor = TypeDescriptor.GetProperties(this)["SelectionStyle"];
             if ((propertyDescriptor != null) && (propertyDescriptor.PropertyType == typeof(int)))
             {
                 propertyDescriptor.SetValue(this, (int)selectionStyle);
             }
         }
     }
 }
示例#12
0
        protected override void OnBubbleEvent(RadElement sender, RoutedEventArgs args)
        {
            base.OnBubbleEvent(sender, args);

            if (args.RoutedEvent == RadItem.MouseClickedEvent)
            {
                if (GetSite() != null && !(this.ElementTree.Control is RadMenu))
                {
                    ISelectionService service = this.Site.GetService(typeof(ISelectionService)) as ISelectionService;

                    if (service != null && !service.GetComponentSelected(this))
                    {
                        service.SetSelectedComponents(new IComponent[] { this });
                    }
                }
            }
        }
        private void OnComponentChanged(object sender, ComponentChangedEventArgs ce)
        {
            IComponent component = ce.Component as IComponent;

            if (component != null)
            {
                ISite site = component.Site;
                if (site != null)
                {
                    ISelectionService service = site.GetService(typeof(ISelectionService)) as ISelectionService;
                    if ((service != null) && service.GetComponentSelected(component))
                    {
                        this.OnSelectionChanged(this, EventArgs.Empty);
                    }
                }
            }
        }
        protected override bool GetHitTest(Point point)
        {
            Control c = MyNotebook.GetChildAtPoint(MyNotebook.PointToClient(point));

            if (c is NotebookPage)
                return true;

            // select the notebook before we forward mouse events to the notebook and/or navigator.
            ISelectionService select = (ISelectionService)GetService(typeof(ISelectionService));

            if (select.GetComponentSelected(MyNotebook))
            {
                return true;
            }
            else
                return false;

        }
        public override bool OnMouseLeave(Glyph g)
        {
            ToolStripItemGlyph glyph = g as ToolStripItemGlyph;

            if (glyph != null)
            {
                ToolStripItem item = glyph.Item;
                if (this.MouseHandlerPresent(item))
                {
                    return(false);
                }
                ISelectionService selectionService = this.GetSelectionService(item);
                if ((selectionService != null) && !selectionService.GetComponentSelected(item))
                {
                    this.ClearInsertionMark(item);
                }
            }
            return(false);
        }
示例#16
0
 protected override void OnClick(EventArgs e)
 {
     if (this.GetSite() != null && !(this.ElementTree.Control is RadMenu))
     {
         ISelectionService service = this.Site.GetService(typeof(ISelectionService)) as ISelectionService;
         if (service == null || service.GetComponentSelected((object)this))
         {
             return;
         }
         service.SetSelectedComponents((ICollection) new IComponent[1]
         {
             (IComponent)this
         });
     }
     else
     {
         base.OnClick(e);
     }
 }
示例#17
0
            private void MaybeAdd(ArrayList l, Control ctl, bool selected, OLECONTF dwOleContF, bool ignoreBelong)
            {
                if (!ignoreBelong && ctl != parent && !GetControlBelongs(ctl))
                {
                    return;
                }

                if (selected)
                {
                    ISelectionService iss = GetSelectionService(ctl);
                    if (iss is null || !iss.GetComponentSelected(this))
                    {
                        return;
                    }
                }
                if (ctl is AxHost hostctl && (dwOleContF & OLECONTF.EMBEDDINGS) != 0)
                {
                    l.Add(hostctl.GetOcx());
                }
 /// <summary>
 ///  overriden to "clear" the boundary-paint when the mouse leave the item
 /// </summary>
 public override bool OnMouseLeave(Glyph g)
 {
     if (g is ToolStripItemGlyph glyph)
     {
         ToolStripItem glyphItem = glyph.Item;
         if (MouseHandlerPresent(glyphItem))
         {
             return(false);
         }
         ISelectionService selSvc = GetSelectionService(glyphItem);
         if (selSvc != null)
         {
             if (!selSvc.GetComponentSelected(glyphItem))
             {
                 ClearInsertionMark(glyphItem);
             }
         }
     }
     return(false);
 }
示例#19
0
        protected override void OnBubbleEvent(RadElement sender, RoutedEventArgs args)
        {
            base.OnBubbleEvent(sender, args);
            if (args.RoutedEvent != RadElement.MouseClickedEvent)
            {
                return;
            }
            ControlTraceMonitor.TrackAtomicFeature((RadElement)this, "Click", (object)this.Text);
            if (this.GetSite() == null || this.ElementTree.Control is RadMenu)
            {
                return;
            }
            ISelectionService service = this.Site.GetService(typeof(ISelectionService)) as ISelectionService;

            if (service == null || service.GetComponentSelected((object)this))
            {
                return;
            }
            service.SetSelectedComponents((ICollection) new IComponent[1]
            {
                (IComponent)this
            });
        }
示例#20
0
        protected override bool OnKeyDown(KeyEventArgs eventArgs)
        {
            if ((eventArgs != null) && ((eventArgs.KeyCode == Keys.PageUp) || (eventArgs.KeyCode == Keys.Next)))
            {
                this.UpdateViewOnPageUpDown(eventArgs.KeyCode == Keys.PageUp);
            }
            ISelectionService service = ((IServiceProvider)base.ParentView).GetService(typeof(ISelectionService)) as ISelectionService;

            if (eventArgs.KeyCode == Keys.Enter)
            {
                IDesigner designer = ActivityDesigner.GetDesigner(service.PrimarySelection as Activity);
                if (designer != null)
                {
                    designer.DoDefaultAction();
                    eventArgs.Handled = true;
                }
            }
            else if (eventArgs.KeyCode == Keys.Escape)
            {
                if (!eventArgs.Handled)
                {
                    CompositeActivityDesigner parentDesigner = ActivityDesigner.GetParentDesigner(service.PrimarySelection);
                    if (parentDesigner != null)
                    {
                        service.SetSelectedComponents(new object[] { parentDesigner.Activity }, SelectionTypes.Replace);
                    }
                    eventArgs.Handled = true;
                }
            }
            else if (eventArgs.KeyCode == Keys.Delete)
            {
                IDesignerHost host = ((IServiceProvider)base.ParentView).GetService(typeof(IDesignerHost)) as IDesignerHost;
                if ((host != null) && !service.GetComponentSelected(host.RootComponent))
                {
                    ICollection selectedComponents = service.GetSelectedComponents();
                    if (DesignerHelpers.AreComponentsRemovable(selectedComponents))
                    {
                        List <Activity> activities = new List <Activity>(Helpers.GetTopLevelActivities(service.GetSelectedComponents()));
                        bool            flag       = activities.Count > 0;
                        foreach (DictionaryEntry entry in Helpers.PairUpCommonParentActivities(activities))
                        {
                            CompositeActivityDesigner designer3 = ActivityDesigner.GetDesigner(entry.Key as Activity) as CompositeActivityDesigner;
                            if ((designer3 != null) && !designer3.CanRemoveActivities(new List <Activity>((Activity[])((ArrayList)entry.Value).ToArray(typeof(Activity))).AsReadOnly()))
                            {
                                flag = false;
                            }
                        }
                        if (flag)
                        {
                            List <ConnectorHitTestInfo> components = new List <ConnectorHitTestInfo>();
                            foreach (object obj2 in selectedComponents)
                            {
                                ConnectorHitTestInfo item = obj2 as ConnectorHitTestInfo;
                                if (item != null)
                                {
                                    components.Add(item);
                                }
                            }
                            CompositeActivityDesigner.RemoveActivities(base.ParentView, activities.AsReadOnly(), SR.GetString("DeletingActivities"));
                            if ((service != null) && (components.Count > 0))
                            {
                                service.SetSelectedComponents(components, SelectionTypes.Add);
                            }
                            eventArgs.Handled = true;
                        }
                    }
                }
            }
            else if (((eventArgs.KeyCode == Keys.Left) || (eventArgs.KeyCode == Keys.Right)) || (((eventArgs.KeyCode == Keys.Up) || (eventArgs.KeyCode == Keys.Down)) || (eventArgs.KeyCode == Keys.Tab)))
            {
                ActivityDesigner designer4 = ActivityDesigner.GetDesigner(service.PrimarySelection as Activity);
                if ((designer4 != null) && (designer4.ParentDesigner != null))
                {
                    ((IWorkflowDesignerMessageSink)designer4.ParentDesigner).OnKeyDown(eventArgs);
                    eventArgs.Handled = true;
                }
            }
            if (!eventArgs.Handled)
            {
                ActivityDesigner designerWithFocus = this.GetDesignerWithFocus();
                if (designerWithFocus != null)
                {
                    ((IWorkflowDesignerMessageSink)designerWithFocus).OnKeyDown(eventArgs);
                }
            }
            return(eventArgs.Handled);
        }
        private bool CanInitiateDragDrop()
        {
            ISelectionService service = (ISelectionService)base.GetService(typeof(ISelectionService));
            IDesignerHost     host    = (IDesignerHost)base.GetService(typeof(IDesignerHost));

            if ((service == null) || (host == null))
            {
                return(false);
            }
            ICollection selectedComponents = service.GetSelectedComponents();

            return(((selectedComponents != null) && (selectedComponents.Count >= 1)) && (!service.GetComponentSelected(host.RootComponent) && Helpers.AreAllActivities(selectedComponents)));
        }
示例#22
0
        private void OnSelectionChanged(object sender, EventArgs e)
        {
            ISelectionService service = sender as ISelectionService;

            if (service != null)
            {
                System.Windows.Forms.ToolStripItem primarySelection = service.PrimarySelection as System.Windows.Forms.ToolStripItem;
                System.Windows.Forms.ToolStripItem.ToolStripItemAccessibleObject accessibilityObject = this.ToolStripItem.AccessibilityObject as System.Windows.Forms.ToolStripItem.ToolStripItemAccessibleObject;
                if (accessibilityObject != null)
                {
                    accessibilityObject.AddState(AccessibleStates.None);
                    ToolStrip mainToolStrip = this.GetMainToolStrip();
                    if (service.GetComponentSelected(this.ToolStripItem))
                    {
                        ToolStrip immediateParent = this.ImmediateParent as ToolStrip;
                        int       index           = 0;
                        if (immediateParent != null)
                        {
                            index = immediateParent.Items.IndexOf(primarySelection);
                        }
                        accessibilityObject.AddState(AccessibleStates.Selected);
                        if (mainToolStrip != null)
                        {
                            System.Design.UnsafeNativeMethods.NotifyWinEvent(0x8007, new HandleRef(immediateParent, immediateParent.Handle), -4, index + 1);
                        }
                        if (primarySelection == this.ToolStripItem)
                        {
                            accessibilityObject.AddState(AccessibleStates.Focused);
                            if (mainToolStrip != null)
                            {
                                System.Design.UnsafeNativeMethods.NotifyWinEvent(0x8005, new HandleRef(immediateParent, immediateParent.Handle), -4, index + 1);
                            }
                        }
                    }
                }
                if ((((primarySelection != null) && (this.ToolStripItem != null)) && (primarySelection.IsOnDropDown && this.ToolStripItem.Equals(primarySelection))) && !(this.ToolStripItem is ToolStripMenuItem))
                {
                    IDesignerHost host = (IDesignerHost)this.GetService(typeof(IDesignerHost));
                    if (host != null)
                    {
                        ToolStripDropDown owner = primarySelection.Owner as ToolStripDropDown;
                        if ((owner != null) && !owner.Visible)
                        {
                            ToolStripDropDownItem ownerItem = owner.OwnerItem as ToolStripDropDownItem;
                            if (ownerItem != null)
                            {
                                ToolStripMenuItemDesigner designer = (ToolStripMenuItemDesigner)host.GetDesigner(ownerItem);
                                if (designer != null)
                                {
                                    designer.InitializeDropDown();
                                }
                                SelectionManager manager = (SelectionManager)this.GetService(typeof(SelectionManager));
                                if (manager != null)
                                {
                                    manager.Refresh();
                                }
                            }
                        }
                    }
                }
            }
        }
        /// <summary>
        ///  When any MouseMove message enters the BehaviorService's AdornerWindow (mousemove, ncmousemove) it is first passed here, to the top-most Behavior in the BehaviorStack.  Returning 'true' from this function signifies that  the Message was 'handled' by the Behavior and should not continue to be processed.
        /// </summary>
        public override bool OnMouseMove(Glyph g, MouseButtons button, Point mouseLoc)
        {
            bool retVal = false;
            ToolStripItemGlyph glyph     = g as ToolStripItemGlyph;
            ToolStripItem      glyphItem = glyph.Item;
            ISelectionService  selSvc    = GetSelectionService(glyphItem);

            if (selSvc == null || glyphItem.Site == null || MouseHandlerPresent(glyphItem))
            {
                return(false);
            }
            if (!selSvc.GetComponentSelected(glyphItem))
            {
                PaintInsertionMark(glyphItem);
                retVal = false;
            }

            if (button == MouseButtons.Left && glyph != null && glyph.ItemDesigner != null && !glyph.ItemDesigner.IsEditorActive)
            {
                Rectangle     dragBox      = Rectangle.Empty;
                IDesignerHost designerHost = (IDesignerHost)glyphItem.Site.GetService(typeof(IDesignerHost));
                Debug.Assert(designerHost != null, "Invalid DesignerHost");
                if (glyphItem.Placement == ToolStripItemPlacement.Overflow || (glyphItem.Placement == ToolStripItemPlacement.Main && !(glyphItem.IsOnDropDown)))
                {
                    ToolStripItemDesigner itemDesigner    = glyph.ItemDesigner;
                    ToolStrip             parentToolStrip = itemDesigner.GetMainToolStrip();
                    if (designerHost.GetDesigner(parentToolStrip) is ToolStripDesigner parentDesigner)
                    {
                        dragBox = parentDesigner.DragBoxFromMouseDown;
                    }
                }
                else if (glyphItem.IsOnDropDown)
                {
                    //Get the OwnerItem's Designer and set the value...
                    if (glyphItem.Owner is ToolStripDropDown parentDropDown)
                    {
                        ToolStripItem ownerItem = parentDropDown.OwnerItem;
                        if (designerHost.GetDesigner(ownerItem) is ToolStripItemDesigner ownerItemDesigner)
                        {
                            dragBox = ownerItemDesigner.dragBoxFromMouseDown;
                        }
                    }
                }
                // If the mouse moves outside the rectangle, start the drag.
                if (dragBox != Rectangle.Empty && !dragBox.Contains(mouseLoc.X, mouseLoc.Y))
                {
                    if (_timer != null)
                    {
                        _timer.Enabled = false;
                        _timer.Tick   -= new System.EventHandler(OnDoubleClickTimerTick);
                        _timer.Dispose();
                        _timer = null;
                    }

                    // Proceed with the drag and drop, passing in the list item.
                    try
                    {
                        ArrayList   dragItems = new ArrayList();
                        ICollection selComps  = selSvc.GetSelectedComponents();
                        //create our list of controls-to-drag
                        foreach (IComponent comp in selComps)
                        {
                            if (comp is ToolStripItem item)
                            {
                                dragItems.Add(item);
                            }
                        }

                        //Start Drag-Drop only if ToolStripItem is the primary Selection
                        if (selSvc.PrimarySelection is ToolStripItem selectedItem)
                        {
                            ToolStrip owner = selectedItem.Owner;
                            ToolStripItemDataObject data = new ToolStripItemDataObject(dragItems, selectedItem, owner);
                            DropSource.QueryContinueDrag += new QueryContinueDragEventHandler(QueryContinueDrag);
                            if (glyphItem is ToolStripDropDownItem ddItem)
                            {
                                if (designerHost.GetDesigner(ddItem) is ToolStripMenuItemDesigner itemDesigner)
                                {
                                    itemDesigner.InitializeBodyGlyphsForItems(false, ddItem);
                                    ddItem.HideDropDown();
                                }
                            }
                            else if (glyphItem.IsOnDropDown && !glyphItem.IsOnOverflow)
                            {
                                ToolStripDropDown     dropDown  = glyphItem.GetCurrentParent() as ToolStripDropDown;
                                ToolStripDropDownItem ownerItem = dropDown.OwnerItem as ToolStripDropDownItem;
                                selSvc.SetSelectedComponents(new IComponent[] { ownerItem }, SelectionTypes.Replace);
                            }
                            DropSource.DoDragDrop(data, DragDropEffects.All);
                        }
                    }
                    finally
                    {
                        DropSource.QueryContinueDrag -= new QueryContinueDragEventHandler(QueryContinueDrag);
                        //Reset all Drag-Variables
                        SetParentDesignerValuesForDragDrop(glyphItem, false, Point.Empty);
                        ToolStripDesigner.s_dragItem = null;
                        _dropSource = null;
                    }
                    retVal = false;
                }
            }
            return(retVal);
        }
        // Occurs when MouseDown on the TooLStripItem glyph
        public override bool OnMouseDown(Glyph g, MouseButtons button, Point mouseLoc)
        {
            ToolStripItemGlyph glyph     = g as ToolStripItemGlyph;
            ToolStripItem      glyphItem = glyph.Item;
            ISelectionService  selSvc    = GetSelectionService(glyphItem);
            BehaviorService    bSvc      = GetBehaviorService(glyphItem);
            ToolStripKeyboardHandlingService keyService = GetKeyBoardHandlingService(glyphItem);

            if ((button == MouseButtons.Left) && (keyService != null) && (keyService.TemplateNodeActive))
            {
                if (keyService.ActiveTemplateNode.IsSystemContextMenuDisplayed)
                {
                    // skip behaviors when the context menu is displayed
                    return(false);
                }
            }

            IDesignerHost designerHost = (IDesignerHost)glyphItem.Site.GetService(typeof(IDesignerHost));

            Debug.Assert(designerHost != null, "Invalid DesignerHost");

            //Cache original selection
            ICollection originalSelComps = null;

            if (selSvc != null)
            {
                originalSelComps = selSvc.GetSelectedComponents();
            }

            // Add the TemplateNode to the Selection if it is currently Selected as the GetSelectedComponents wont do it for us.
            ArrayList origSel = new ArrayList(originalSelComps);

            if (origSel.Count == 0)
            {
                if (keyService != null && keyService.SelectedDesignerControl != null)
                {
                    origSel.Add(keyService.SelectedDesignerControl);
                }
            }

            if (keyService != null)
            {
                keyService.SelectedDesignerControl = null;
                if (keyService.TemplateNodeActive)
                {
                    // If templateNode Active .. commit and Select it
                    keyService.ActiveTemplateNode.CommitAndSelect();
                    // if the selected item is clicked .. then commit the node and reset the selection (refer 488002)
                    if (selSvc.PrimarySelection is ToolStripItem currentSel && currentSel == glyphItem)
                    {
                        selSvc.SetSelectedComponents(null, SelectionTypes.Replace);
                    }
                }
            }

            if (selSvc == null || MouseHandlerPresent(glyphItem))
            {
                return(false);
            }

            if (glyph != null && button == MouseButtons.Left)
            {
                ToolStripItem selectedItem = selSvc.PrimarySelection as ToolStripItem;
                // Always set the Drag-Rect for Drag-Drop...
                SetParentDesignerValuesForDragDrop(glyphItem, true, mouseLoc);
                // Check if this item is already selected ...
                if (selectedItem != null && selectedItem == glyphItem)
                {
                    // If the Selecteditem is already in editmode ... bail out
                    if (selectedItem != null)
                    {
                        ToolStripItemDesigner selectedItemDesigner = glyph.ItemDesigner;
                        if (selectedItemDesigner != null && selectedItemDesigner.IsEditorActive)
                        {
                            return(false);
                        }
                    }

                    // Check if this is CTRL + Click or SHIFT + Click, if so then just remove the selection
                    bool removeSel = (Control.ModifierKeys & (Keys.Control | Keys.Shift)) > 0;
                    if (removeSel)
                    {
                        selSvc.SetSelectedComponents(new IComponent[] { selectedItem }, SelectionTypes.Remove);
                        return(false);
                    }

                    //start Double Click Timer
                    // This is required for the second down in selection which can be the first down of a Double click on the glyph confusing... hence this comment ...
                    // Heres the scenario ....
                    // DOWN 1 - selects the ITEM
                    // DOWN 2 - ITEM goes into INSITU....
                    // DOUBLE CLICK - dont show code..
                    // Open INSITU after the double click time
                    if (selectedItem is ToolStripMenuItem)
                    {
                        _timer = new Timer
                        {
                            Interval = SystemInformation.DoubleClickTime
                        };
                        _timer.Tick   += new EventHandler(OnDoubleClickTimerTick);
                        _timer.Enabled = true;
                        _selectedGlyph = glyph;
                    }
                }
                else
                {
                    bool shiftPressed = (Control.ModifierKeys & Keys.Shift) > 0;
                    // We should process MouseDown only if we are not yet selected....
                    if (!selSvc.GetComponentSelected(glyphItem))
                    {
                        //Reset the State... On the Glpyhs .. we get MouseDown - Mouse UP (for single Click) And we get MouseDown - MouseUp - DoubleClick - Up (for double Click) Hence reset the state at start....
                        _mouseUpFired     = false;
                        _doubleClickFired = false;
                        //Implementing Shift + Click....
                        // we have 2 items, namely, selectedItem (current PrimarySelection) and glyphItem (item which has received mouseDown) FIRST check if they have common parent...  IF YES then get the indices of the two and SELECT all items from LOWER index to the HIGHER index.
                        if (shiftPressed && (selectedItem != null && CommonParent(selectedItem, glyphItem)))
                        {
                            ToolStrip parent = null;
                            if (glyphItem.IsOnOverflow)
                            {
                                parent = glyphItem.Owner;
                            }
                            else
                            {
                                parent = glyphItem.GetCurrentParent();
                            }
                            int startIndexOfSelection = Math.Min(parent.Items.IndexOf(selectedItem), parent.Items.IndexOf(glyphItem));
                            int endIndexOfSelection   = Math.Max(parent.Items.IndexOf(selectedItem), parent.Items.IndexOf(glyphItem));
                            int countofItemsSelected  = (endIndexOfSelection - startIndexOfSelection) + 1;

                            // if two adjacent items are selected ...
                            if (countofItemsSelected == 2)
                            {
                                selSvc.SetSelectedComponents(new IComponent[] { glyphItem });
                            }
                            else
                            {
                                object[] totalObjects = new object[countofItemsSelected];
                                int      j            = 0;
                                for (int i = startIndexOfSelection; i <= endIndexOfSelection; i++)
                                {
                                    totalObjects[j++] = parent.Items[i];
                                }
                                selSvc.SetSelectedComponents(new IComponent[] { parent }, SelectionTypes.Replace);
                                ToolStripDesigner.s_shiftState = true;
                                selSvc.SetSelectedComponents(totalObjects, SelectionTypes.Replace);
                            }
                        }
                        //End Implmentation
                        else
                        {
                            if (glyphItem.IsOnDropDown && ToolStripDesigner.s_shiftState)
                            {
                                //Invalidate glyh only if we are in ShiftState...
                                ToolStripDesigner.s_shiftState = false;
                                if (bSvc != null)
                                {
                                    bSvc.Invalidate(glyphItem.Owner.Bounds);
                                }
                            }
                            selSvc.SetSelectedComponents(new IComponent[] { glyphItem }, SelectionTypes.Auto);
                        }
                        // Set the appropriate object.
                        if (keyService != null)
                        {
                            keyService.ShiftPrimaryItem = glyphItem;
                        }
                    }
                    // we are already selected and if shiftpressed...
                    else if (shiftPressed || (Control.ModifierKeys & Keys.Control) > 0)
                    {
                        selSvc.SetSelectedComponents(new IComponent[] { glyphItem }, SelectionTypes.Remove);
                    }
                }
            }

            if (glyph != null && button == MouseButtons.Right)
            {
                if (!selSvc.GetComponentSelected(glyphItem))
                {
                    selSvc.SetSelectedComponents(new IComponent[] { glyphItem });
                }
            }

            // finally Invalidate all selections
            ToolStripDesignerUtils.InvalidateSelection(origSel, glyphItem, glyphItem.Site, false);
            return(false);
        }
        public override bool OnMouseDown(Glyph g, MouseButtons button, Point mouseLoc)
        {
            ToolStripItemGlyph glyph            = g as ToolStripItemGlyph;
            ToolStripItem      item             = glyph.Item;
            ISelectionService  selectionService = this.GetSelectionService(item);
            BehaviorService    behaviorService  = this.GetBehaviorService(item);
            ToolStripKeyboardHandlingService keyBoardHandlingService = this.GetKeyBoardHandlingService(item);

            if (((button != MouseButtons.Left) || (keyBoardHandlingService == null)) || (!keyBoardHandlingService.TemplateNodeActive || !keyBoardHandlingService.ActiveTemplateNode.IsSystemContextMenuDisplayed))
            {
                IDesignerHost service          = (IDesignerHost)item.Site.GetService(typeof(IDesignerHost));
                ToolStripItem primarySelection = selectionService.PrimarySelection as ToolStripItem;
                ICollection   c = null;
                if (selectionService != null)
                {
                    c = selectionService.GetSelectedComponents();
                }
                ArrayList originalSelComps = new ArrayList(c);
                if (((originalSelComps.Count == 0) && (keyBoardHandlingService != null)) && (keyBoardHandlingService.SelectedDesignerControl != null))
                {
                    originalSelComps.Add(keyBoardHandlingService.SelectedDesignerControl);
                }
                if (keyBoardHandlingService != null)
                {
                    keyBoardHandlingService.SelectedDesignerControl = null;
                    if (keyBoardHandlingService.TemplateNodeActive)
                    {
                        keyBoardHandlingService.ActiveTemplateNode.CommitAndSelect();
                        if ((primarySelection != null) && (primarySelection == item))
                        {
                            selectionService.SetSelectedComponents(null, SelectionTypes.Replace);
                        }
                    }
                }
                if ((selectionService == null) || this.MouseHandlerPresent(item))
                {
                    return(false);
                }
                if ((glyph != null) && (button == MouseButtons.Left))
                {
                    ToolStripItem oldSelection = selectionService.PrimarySelection as ToolStripItem;
                    this.SetParentDesignerValuesForDragDrop(item, true, mouseLoc);
                    if ((oldSelection != null) && (oldSelection == item))
                    {
                        if (oldSelection != null)
                        {
                            ToolStripItemDesigner itemDesigner = glyph.ItemDesigner;
                            if ((itemDesigner != null) && itemDesigner.IsEditorActive)
                            {
                                return(false);
                            }
                        }
                        if ((Control.ModifierKeys & (Keys.Control | Keys.Shift)) > Keys.None)
                        {
                            selectionService.SetSelectedComponents(new IComponent[] { oldSelection }, SelectionTypes.Remove);
                            return(false);
                        }
                        if (oldSelection is ToolStripMenuItem)
                        {
                            this._timer          = new Timer();
                            this._timer.Interval = SystemInformation.DoubleClickTime;
                            this._timer.Tick    += new EventHandler(this.OnDoubleClickTimerTick);
                            this._timer.Enabled  = true;
                            this.selectedGlyph   = glyph;
                        }
                    }
                    else
                    {
                        bool flag2 = (Control.ModifierKeys & Keys.Shift) > Keys.None;
                        if (!selectionService.GetComponentSelected(item))
                        {
                            this.mouseUpFired     = false;
                            this.doubleClickFired = false;
                            if ((flag2 && (oldSelection != null)) && this.CommonParent(oldSelection, item))
                            {
                                ToolStrip owner = null;
                                if (item.IsOnOverflow)
                                {
                                    owner = item.Owner;
                                }
                                else
                                {
                                    owner = item.GetCurrentParent();
                                }
                                int num  = Math.Min(owner.Items.IndexOf(oldSelection), owner.Items.IndexOf(item));
                                int num2 = Math.Max(owner.Items.IndexOf(oldSelection), owner.Items.IndexOf(item));
                                int num3 = (num2 - num) + 1;
                                if (num3 == 2)
                                {
                                    selectionService.SetSelectedComponents(new IComponent[] { item });
                                }
                                else
                                {
                                    object[] components = new object[num3];
                                    int      num4       = 0;
                                    for (int i = num; i <= num2; i++)
                                    {
                                        components[num4++] = owner.Items[i];
                                    }
                                    selectionService.SetSelectedComponents(new IComponent[] { owner }, SelectionTypes.Replace);
                                    ToolStripDesigner.shiftState = true;
                                    selectionService.SetSelectedComponents(components, SelectionTypes.Replace);
                                }
                            }
                            else
                            {
                                if (item.IsOnDropDown && ToolStripDesigner.shiftState)
                                {
                                    ToolStripDesigner.shiftState = false;
                                    if (behaviorService != null)
                                    {
                                        behaviorService.Invalidate(item.Owner.Bounds);
                                    }
                                }
                                selectionService.SetSelectedComponents(new IComponent[] { item }, SelectionTypes.Auto);
                            }
                            if (keyBoardHandlingService != null)
                            {
                                keyBoardHandlingService.ShiftPrimaryItem = item;
                            }
                        }
                        else if (flag2 || ((Control.ModifierKeys & Keys.Control) > Keys.None))
                        {
                            selectionService.SetSelectedComponents(new IComponent[] { item }, SelectionTypes.Remove);
                        }
                    }
                }
                if (((glyph != null) && (button == MouseButtons.Right)) && !selectionService.GetComponentSelected(item))
                {
                    selectionService.SetSelectedComponents(new IComponent[] { item });
                }
                ToolStripDesignerUtils.InvalidateSelection(originalSelComps, item, item.Site, false);
            }
            return(false);
        }
        public override bool OnMouseMove(Glyph g, MouseButtons button, Point mouseLoc)
        {
            bool flag = false;
            ToolStripItemGlyph glyph            = g as ToolStripItemGlyph;
            ToolStripItem      item             = glyph.Item;
            ISelectionService  selectionService = this.GetSelectionService(item);

            if (((selectionService != null) && (item.Site != null)) && !this.MouseHandlerPresent(item))
            {
                if (!selectionService.GetComponentSelected(item))
                {
                    this.PaintInsertionMark(item);
                    flag = false;
                }
                if (((button != MouseButtons.Left) || (glyph == null)) || ((glyph.ItemDesigner == null) || glyph.ItemDesigner.IsEditorActive))
                {
                    return(flag);
                }
                Rectangle     empty   = Rectangle.Empty;
                IDesignerHost service = (IDesignerHost)item.Site.GetService(typeof(IDesignerHost));
                if ((item.Placement == ToolStripItemPlacement.Overflow) || ((item.Placement == ToolStripItemPlacement.Main) && !item.IsOnDropDown))
                {
                    ToolStrip         mainToolStrip = glyph.ItemDesigner.GetMainToolStrip();
                    ToolStripDesigner designer      = service.GetDesigner(mainToolStrip) as ToolStripDesigner;
                    if (designer != null)
                    {
                        empty = designer.DragBoxFromMouseDown;
                    }
                }
                else if (item.IsOnDropDown)
                {
                    ToolStripDropDown owner = item.Owner as ToolStripDropDown;
                    if (owner != null)
                    {
                        ToolStripItem         ownerItem = owner.OwnerItem;
                        ToolStripItemDesigner designer3 = service.GetDesigner(ownerItem) as ToolStripItemDesigner;
                        if (designer3 != null)
                        {
                            empty = designer3.dragBoxFromMouseDown;
                        }
                    }
                }
                if (!(empty != Rectangle.Empty) || empty.Contains(mouseLoc.X, mouseLoc.Y))
                {
                    return(flag);
                }
                if (this._timer != null)
                {
                    this._timer.Enabled = false;
                    this._timer.Tick   -= new EventHandler(this.OnDoubleClickTimerTick);
                    this._timer.Dispose();
                    this._timer = null;
                }
                try
                {
                    ArrayList dragComponents = new ArrayList();
                    foreach (IComponent component in selectionService.GetSelectedComponents())
                    {
                        ToolStripItem item3 = component as ToolStripItem;
                        if (item3 != null)
                        {
                            dragComponents.Add(item3);
                        }
                    }
                    ToolStripItem primarySelection = selectionService.PrimarySelection as ToolStripItem;
                    if (primarySelection != null)
                    {
                        ToolStrip strip2             = primarySelection.Owner;
                        ToolStripItemDataObject data = new ToolStripItemDataObject(dragComponents, primarySelection, strip2);
                        this.DropSource.QueryContinueDrag += new QueryContinueDragEventHandler(this.QueryContinueDrag);
                        ToolStripDropDownItem item5 = item as ToolStripDropDownItem;
                        if (item5 != null)
                        {
                            ToolStripMenuItemDesigner designer4 = service.GetDesigner(item5) as ToolStripMenuItemDesigner;
                            if (designer4 != null)
                            {
                                designer4.InitializeBodyGlyphsForItems(false, item5);
                                item5.HideDropDown();
                            }
                        }
                        else if (item.IsOnDropDown && !item.IsOnOverflow)
                        {
                            ToolStripDropDown     currentParent = item.GetCurrentParent() as ToolStripDropDown;
                            ToolStripDropDownItem item6         = currentParent.OwnerItem as ToolStripDropDownItem;
                            selectionService.SetSelectedComponents(new IComponent[] { item6 }, SelectionTypes.Replace);
                        }
                        this.DropSource.DoDragDrop(data, DragDropEffects.Move | DragDropEffects.Copy | DragDropEffects.Scroll);
                    }
                }
                finally
                {
                    this.DropSource.QueryContinueDrag -= new QueryContinueDragEventHandler(this.QueryContinueDrag);
                    this.SetParentDesignerValuesForDragDrop(item, false, Point.Empty);
                    ToolStripDesigner.dragItem = null;
                    this.dropSource            = null;
                }
            }
            return(false);
        }
示例#27
0
        protected override bool OnKeyDown(KeyEventArgs eventArgs)
        {
            if (eventArgs != null && (eventArgs.KeyCode == Keys.PageUp || eventArgs.KeyCode == Keys.PageDown))
            {
                UpdateViewOnPageUpDown(eventArgs.KeyCode == Keys.PageUp);
            }
            ISelectionService selectionService = ((IServiceProvider)this.ParentView).GetService(typeof(ISelectionService)) as ISelectionService;

            //enter key (
            if (eventArgs.KeyCode == Keys.Enter)
            {
                // on enter key we want to do DoDefault of the designer
                IDesigner designer = ActivityDesigner.GetDesigner(selectionService.PrimarySelection as Activity) as IDesigner;
                if (designer != null)
                {
                    designer.DoDefaultAction();
                    eventArgs.Handled = true;
                }
            }
            else if (eventArgs.KeyCode == Keys.Escape)
            {
                if (!eventArgs.Handled)
                {
                    CompositeActivityDesigner parentDesigner = ActivityDesigner.GetParentDesigner(selectionService.PrimarySelection);
                    if (parentDesigner != null)
                    {
                        selectionService.SetSelectedComponents(new object[] { parentDesigner.Activity }, SelectionTypes.Replace);
                    }

                    eventArgs.Handled = true;
                }
            }
            else if (eventArgs.KeyCode == Keys.Delete)
            {
                // check if we are cutting root component
                IDesignerHost designerHost = ((IServiceProvider)this.ParentView).GetService(typeof(IDesignerHost)) as IDesignerHost;
                if (!(designerHost == null || selectionService.GetComponentSelected(designerHost.RootComponent)))
                {
                    //Check that we are cutting all activities
                    //Check if we are in writable context
                    ICollection components = selectionService.GetSelectedComponents();
                    if (DesignerHelpers.AreComponentsRemovable(components))
                    {
                        // check if we can delete these
                        List <Activity> topLevelActivities     = new List <Activity>(Helpers.GetTopLevelActivities(selectionService.GetSelectedComponents()));
                        bool            needToDelete           = (topLevelActivities.Count > 0);
                        IDictionary     commonParentActivities = Helpers.PairUpCommonParentActivities(topLevelActivities);
                        foreach (DictionaryEntry entry in commonParentActivities)
                        {
                            CompositeActivityDesigner compositeActivityDesigner = ActivityDesigner.GetDesigner(entry.Key as Activity) as CompositeActivityDesigner;
                            if (compositeActivityDesigner != null && !compositeActivityDesigner.CanRemoveActivities(new List <Activity>((Activity[])((ArrayList)entry.Value).ToArray(typeof(Activity))).AsReadOnly()))
                            {
                                needToDelete = false;
                            }
                        }

                        if (needToDelete)
                        {
                            List <ConnectorHitTestInfo> connectors = new List <ConnectorHitTestInfo>();
                            foreach (object component in components)
                            {
                                ConnectorHitTestInfo connector = component as ConnectorHitTestInfo;
                                if (connector != null)
                                {
                                    connectors.Add(connector);
                                }
                            }

                            //cache selcted connectors before calling this func
                            CompositeActivityDesigner.RemoveActivities((IServiceProvider)this.ParentView, topLevelActivities.AsReadOnly(), SR.GetString(SR.DeletingActivities));

                            //add connectors back to the selection service
                            if (selectionService != null && connectors.Count > 0)
                            {
                                selectionService.SetSelectedComponents(connectors, SelectionTypes.Add);
                            }

                            eventArgs.Handled = true;
                        }
                    }
                }
            }
            //navigation (left, right, up, down, tab, shift-tab)
            else if (eventArgs.KeyCode == Keys.Left || eventArgs.KeyCode == Keys.Right || eventArgs.KeyCode == Keys.Up || eventArgs.KeyCode == Keys.Down || eventArgs.KeyCode == Keys.Tab)
            {
                //we'll pass it to the parent designer of the primary selected designer
                //sequential designers just navigate between their children
                //free form designers may move their children on arrow keys and navigate on tab
                ActivityDesigner designer = ActivityDesigner.GetDesigner(selectionService.PrimarySelection as Activity) as ActivityDesigner;
                if (designer != null && designer.ParentDesigner != null)
                {
                    //we will let the parent see if it wants to handle the event,
                    //otherwise the selected designer itself will be called from a designer message filter below
                    ((IWorkflowDesignerMessageSink)designer.ParentDesigner).OnKeyDown(eventArgs);
                    eventArgs.Handled = true;
                }
            }

            if (!eventArgs.Handled)
            {
                ActivityDesigner designerWithFocus = GetDesignerWithFocus();
                if (designerWithFocus != null)
                {
                    ((IWorkflowDesignerMessageSink)designerWithFocus).OnKeyDown(eventArgs);
                }
            }

            return(eventArgs.Handled);
        }
        private void InitiateDragDrop()
        {
            WorkflowView      parentView = base.ParentView;
            ISelectionService service    = (ISelectionService)base.GetService(typeof(ISelectionService));
            IDesignerHost     host       = (IDesignerHost)base.GetService(typeof(IDesignerHost));

            if ((service != null) && (host != null))
            {
                ICollection selectedComponents = service.GetSelectedComponents();
                if (((selectedComponents != null) && (selectedComponents.Count >= 1)) && (!service.GetComponentSelected(host.RootComponent) && Helpers.AreAllActivities(selectedComponents)))
                {
                    DragDropEffects none = DragDropEffects.None;
                    try
                    {
                        this.existingDraggedActivities.AddRange(Helpers.GetTopLevelActivities(selectedComponents));
                        DragDropEffects allowedEffects = DesignerHelpers.AreAssociatedDesignersMovable(this.existingDraggedActivities) ? (DragDropEffects.Move | DragDropEffects.Copy) : DragDropEffects.Copy;
                        IDataObject     data           = CompositeActivityDesigner.SerializeActivitiesToDataObject(base.ParentView, this.existingDraggedActivities.ToArray());
                        none = parentView.DoDragDrop(data, allowedEffects);
                    }
                    catch (Exception exception)
                    {
                        DesignerHelpers.ShowError(base.ParentView, exception.Message);
                    }
                    finally
                    {
                        if ((none == DragDropEffects.Move) && (this.existingDraggedActivities.Count > 0))
                        {
                            string transactionDescription = string.Empty;
                            if (this.existingDraggedActivities.Count > 1)
                            {
                                transactionDescription = SR.GetString("MoveMultipleActivities", new object[] { this.existingDraggedActivities.Count });
                            }
                            else
                            {
                                transactionDescription = SR.GetString("MoveSingleActivity", new object[] { this.existingDraggedActivities[0].GetType() });
                            }
                            CompositeActivityDesigner.RemoveActivities(base.ParentView, this.existingDraggedActivities.AsReadOnly(), transactionDescription);
                        }
                        this.existingDraggedActivities.Clear();
                    }
                }
            }
        }