private void OnStatusPaste(object sender, EventArgs e)
        {
            MenuCommand command = (MenuCommand)sender;

            command.Enabled = false;
            object primarySelection = this.selectionService.PrimarySelection;
            CompositeActivityDesigner parentDesigner = ActivityDesigner.GetDesigner(primarySelection as Activity) as CompositeActivityDesigner;

            if (parentDesigner == null)
            {
                parentDesigner = ActivityDesigner.GetParentDesigner(primarySelection);
            }
            if ((parentDesigner != null) && parentDesigner.IsEditable)
            {
                IDesignerHost   host       = this.serviceProvider.GetService(typeof(IDesignerHost)) as IDesignerHost;
                IToolboxService service    = (IToolboxService)this.serviceProvider.GetService(typeof(IToolboxService));
                IDataObject     dataObject = Clipboard.GetDataObject();
                if (((dataObject != null) && (host != null)) && ((dataObject.GetDataPresent("CF_WINOEDESIGNERCOMPONENTS") || (service == null)) || service.IsSupported(dataObject, host)))
                {
                    System.Workflow.ComponentModel.Design.HitTestInfo insertLocation = null;
                    if (primarySelection is System.Workflow.ComponentModel.Design.HitTestInfo)
                    {
                        insertLocation = (System.Workflow.ComponentModel.Design.HitTestInfo)primarySelection;
                    }
                    else if (primarySelection is CompositeActivity)
                    {
                        insertLocation = new System.Workflow.ComponentModel.Design.HitTestInfo(parentDesigner, HitTestLocations.Designer);
                    }
                    else if (primarySelection is Activity)
                    {
                        Activity                  item     = primarySelection as Activity;
                        CompositeActivity         parent   = item.Parent;
                        CompositeActivityDesigner designer = ActivityDesigner.GetDesigner(parent) as CompositeActivityDesigner;
                        if (designer != null)
                        {
                            insertLocation = new ConnectorHitTestInfo(designer, HitTestLocations.Designer, parent.Activities.IndexOf(item) + 1);
                        }
                    }
                    ICollection activities = null;
                    try
                    {
                        activities = CompositeActivityDesigner.DeserializeActivitiesFromDataObject(this.serviceProvider, dataObject);
                    }
                    catch (CheckoutException exception)
                    {
                        if (exception != CheckoutException.Canceled)
                        {
                            throw exception;
                        }
                    }
                    command.Enabled = ((activities != null) && (insertLocation != null)) && parentDesigner.CanInsertActivities(insertLocation, new List <Activity>(Helpers.GetTopLevelActivities(activities)).AsReadOnly());
                }
            }
        }
Exemple #2
0
        protected override bool OnDragDrop(DragEventArgs eventArgs)
        {
            //Invalidate the entire rectangle so that we draw active placement glyphs on connectors
            WorkflowView parentView = ParentView;

            parentView.InvalidateClientRectangle(Rectangle.Empty);

            //By default we do not allow any drag drop operation
            eventArgs.Effect = DragDropEffects.None;

            DestroyDragFeedbackImages();

            //Get the coordinates
            Point clientPoint  = parentView.PointToClient(new Point(eventArgs.X, eventArgs.Y));
            Point logicalPoint = parentView.ScreenPointToLogical(new Point(eventArgs.X, eventArgs.Y));

            //Now we check if the drag drop was in any valid area, if not then do not proceed further
            if (!parentView.IsClientPointInActiveLayout(clientPoint))
            {
                if (this.dropTargetDesigner != null)
                {
                    ((IWorkflowDesignerMessageSink)this.dropTargetDesigner).OnDragLeave();
                }
                this.wasCtrlKeyPressed  = false;
                this.dropTargetDesigner = null;
                this.draggedActivities.Clear();
                return(false);
            }

            //Now we have a potential for successful drag drop, so construct drag event arguments with logical coordinates
            this.wasCtrlKeyPressed = ((eventArgs.KeyState & 8) == 8);
            ActivityDragEventArgs dragdropEventArgs = new ActivityDragEventArgs(eventArgs, this.dragInitiationPoint, logicalPoint, this.draggedActivities);

            //Now check which designer is under the cursor, if we have the same designer as the old one
            //If not then we set the new one as drop target and pump in messages
            HitTestInfo hitTestInfo = MessageHitTestContext;

            if (this.dropTargetDesigner != hitTestInfo.AssociatedDesigner)
            {
                if (this.dropTargetDesigner != null)
                {
                    ((IWorkflowDesignerMessageSink)this.dropTargetDesigner).OnDragLeave();
                    this.dropTargetDesigner = null;
                }

                if (hitTestInfo.AssociatedDesigner != null)
                {
                    this.dropTargetDesigner = hitTestInfo.AssociatedDesigner;
                    if (this.dropTargetDesigner != null)
                    {
                        ((IWorkflowDesignerMessageSink)this.dropTargetDesigner).OnDragEnter(dragdropEventArgs);
                    }
                }
            }

            //We now have appropriate droptarget designer
            try
            {
                if (this.dropTargetDesigner != null)
                {
                    //We do not allow recursive drag and drop
                    if (!this.wasCtrlKeyPressed && IsRecursiveDropOperation(this.dropTargetDesigner) ||
                        (this.dropTargetDesigner is CompositeActivityDesigner && !((CompositeActivityDesigner)this.dropTargetDesigner).IsEditable))
                    {
                        ((IWorkflowDesignerMessageSink)this.dropTargetDesigner).OnDragLeave();
                        dragdropEventArgs.Effect = DragDropEffects.None;
                    }
                    else
                    {
                        // IMPORTANT: Don't use draggedActivities variable, because components which are
                        // there may not be created using the assembly references  added to ITypeResultionService
                        // this.workflowView.time the components will be created using the assembly references got added to the project
                        List <Activity> droppedActivities      = new List <Activity>();
                        string          transactionDescription = SR.GetString(SR.DragDropActivities);

                        //This means that we are trying to move activities so we use the same activities for drop
                        if (!this.wasCtrlKeyPressed && this.existingDraggedActivities.Count > 0)
                        {
                            droppedActivities.AddRange(this.existingDraggedActivities);
                            if (droppedActivities.Count > 1)
                            {
                                transactionDescription = SR.GetString(SR.MoveMultipleActivities, droppedActivities.Count);
                            }
                            else if (droppedActivities.Count == 1)
                            {
                                transactionDescription = SR.GetString(SR.MoveSingleActivity, droppedActivities[0].GetType());
                            }
                        }
                        else
                        {
                            droppedActivities.AddRange(CompositeActivityDesigner.DeserializeActivitiesFromDataObject(ParentView, eventArgs.Data, true));
                            if (droppedActivities.Count > 0)
                            {
                                transactionDescription = SR.GetString(SR.CreateActivityFromToolbox, droppedActivities[0].GetType());
                            }
                        }

                        //Now that we have what needs to be dropped, we start the actual drag and drop
                        IDesignerHost       designerHost = GetService(typeof(IDesignerHost)) as IDesignerHost;
                        DesignerTransaction transaction  = null;
                        if (droppedActivities.Count > 0)
                        {
                            transaction = designerHost.CreateTransaction(transactionDescription);
                        }

                        dragdropEventArgs = new ActivityDragEventArgs(eventArgs, this.dragInitiationPoint, logicalPoint, droppedActivities);

                        try
                        {
                            ((IWorkflowDesignerMessageSink)this.dropTargetDesigner).OnDragDrop(dragdropEventArgs);

                            if (dragdropEventArgs.Effect == DragDropEffects.Move)
                            {
                                this.existingDraggedActivities.Clear();
                            }

                            if (transaction != null)
                            {
                                transaction.Commit();
                            }
                        }
                        catch (Exception e)
                        {
                            if (transaction != null)
                            {
                                transaction.Cancel();
                            }
                            throw e;
                        }

                        //We deserialize the designers and try to store the designer states
                        if (droppedActivities.Count > 0)
                        {
                            Stream componentStateStream = eventArgs.Data.GetData(DragDropManager.CF_DESIGNERSTATE) as Stream;
                            if (componentStateStream != null)
                            {
                                Helpers.DeserializeDesignersFromStream(droppedActivities, componentStateStream);
                            }

                            //Set the current selection
                            ISelectionService selectionService = (ISelectionService)GetService(typeof(ISelectionService));
                            if (selectionService != null)
                            {
                                selectionService.SetSelectedComponents(droppedActivities, SelectionTypes.Replace);
                            }
                        }

                        //Active the design surface
                        if (designerHost != null)
                        {
                            designerHost.Activate();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                //We purposely consume application thrown exception which are result of user cancelling the action
                //during dragdrop where we popup UI Wizards during drag drop. Ref: InvokeWebService
                ((IWorkflowDesignerMessageSink)this.dropTargetDesigner).OnDragLeave();
                dragdropEventArgs.Effect = DragDropEffects.None;

                string dragDropException = ex.Message;
                if (ex.InnerException != null && !String.IsNullOrEmpty(ex.InnerException.Message))
                {
                    dragDropException = ex.InnerException.Message;
                }

                string errorMessage = DR.GetString(DR.Error_FailedToDeserializeComponents);
                errorMessage += "\r\n" + DR.GetString(DR.Error_Reason, dragDropException);
                DesignerHelpers.ShowError(ParentView, errorMessage);

                if (ex != CheckoutException.Canceled)
                {
                    throw new Exception(errorMessage, ex);
                }
            }
            finally
            {
                //Make sure that mouse over designer is set to null
                this.wasCtrlKeyPressed = false;
                this.draggedActivities.Clear();
                this.dropTargetDesigner  = null;
                this.exceptionInDragDrop = false;
                eventArgs.Effect         = dragdropEventArgs.Effect;
            }

            return(true);
        }
Exemple #3
0
        protected override bool OnDragEnter(DragEventArgs eventArgs)
        {
            //We purposely pass the DragEnter thru to the next behavior so that the WindowingBehavior can clear the
            //active designer
            Debug.Assert(this.dropTargetDesigner == null);

            //Invalidate the entire rectangle so that we draw active placement glyphs on connectors
            WorkflowView parentView = ParentView;

            parentView.InvalidateClientRectangle(Rectangle.Empty);

            //By default we do not allow any drag drop operation
            eventArgs.Effect       = DragDropEffects.None;
            this.wasCtrlKeyPressed = false;

            //Now cache the components which are getting dragged so that we don't need to create them again and again
            if (this.existingDraggedActivities.Count > 0)
            {
                this.draggedActivities.AddRange(this.existingDraggedActivities);
            }
            else
            {
                try
                {
                    Activity[] activities = CompositeActivityDesigner.DeserializeActivitiesFromDataObject(ParentView, eventArgs.Data);
                    if (activities != null)
                    {
                        this.draggedActivities.AddRange(activities);
                    }
                }
                catch
                {
                    this.exceptionInDragDrop = true;
                }
            }

            //Get the coordinates
            Point clientPoint  = parentView.PointToClient(new Point(eventArgs.X, eventArgs.Y));
            Point logicalPoint = parentView.ScreenPointToLogical(new Point(eventArgs.X, eventArgs.Y));

            //Now try to create the drag image and invalidate the area so that we can draw the dragged image
            Debug.Assert(this.dragImage == null);
            CreateDragFeedbackImages(this.draggedActivities);
            if (this.dragImage != null)
            {
                this.dragImagePointInClientCoOrd = new Point(clientPoint.X + SystemInformation.CursorSize.Width / 4, clientPoint.Y + SystemInformation.CursorSize.Height / 4);
            }

            //If the hit is not in the layouts then we need to bail out, this is very important
            if (!parentView.IsClientPointInActiveLayout(clientPoint))
            {
                return(false);
            }

            //Now we have a potential for successful drag drop, so construct drag event arguments with logical coordinates
            this.wasCtrlKeyPressed = ((eventArgs.KeyState & 8) == 8);
            ActivityDragEventArgs dragdropEventArgs = new ActivityDragEventArgs(eventArgs, this.dragInitiationPoint, logicalPoint, this.draggedActivities);

            //Now check which designer is under the cursor, if there is no designer then we return
            HitTestInfo      hitTestInfo = MessageHitTestContext;
            ActivityDesigner potentialDropTargetDesigner = hitTestInfo.AssociatedDesigner;

            if (potentialDropTargetDesigner == null)
            {
                return(false);
            }

            //Now that we found a potential droptarget designer, make sure that we can start drag drop
            //If the drag drop can not be performed then return.
            if (!this.wasCtrlKeyPressed && IsRecursiveDropOperation(potentialDropTargetDesigner))
            {
                return(false);
            }

            CompositeActivityDesigner compositeDesigner = potentialDropTargetDesigner as CompositeActivityDesigner;

            if (compositeDesigner != null && !compositeDesigner.IsEditable)
            {
                return(false);
            }

            //Now that we can truely perform drag and drop operation we can pump in the message
            this.dropTargetDesigner = potentialDropTargetDesigner;
            ((IWorkflowDesignerMessageSink)this.dropTargetDesigner).OnDragEnter(dragdropEventArgs);

            //Check the return value, if this is a potential snap location then we need to snap the image
            if (!dragdropEventArgs.DragImageSnapPoint.IsEmpty)
            {
                Point midPointInClientCoOrd = parentView.LogicalPointToClient(dragdropEventArgs.DragImageSnapPoint);
                Size  dragImageIconSize     = parentView.LogicalSizeToClient(AmbientTheme.DragImageIconSize);
                this.dragImagePointInClientCoOrd = new Point(midPointInClientCoOrd.X - dragImageIconSize.Width / 2, midPointInClientCoOrd.Y - dragImageIconSize.Height / 2);
                this.dragImageSnapped            = true;
            }

            eventArgs.Effect = dragdropEventArgs.Effect;

            if (eventArgs.Effect == DragDropEffects.None && this.exceptionInDragDrop)
            {
                eventArgs.Effect = (this.wasCtrlKeyPressed) ? DragDropEffects.Copy : DragDropEffects.Move;
            }

            return(true);
        }
        private void OnMenuPaste(object sender, EventArgs e)
        {
            object primarySelection = this.selectionService.PrimarySelection;
            CompositeActivityDesigner parentDesigner = ActivityDesigner.GetDesigner(primarySelection as Activity) as CompositeActivityDesigner;

            if (parentDesigner == null)
            {
                parentDesigner = ActivityDesigner.GetParentDesigner(primarySelection);
            }
            if ((parentDesigner != null) && parentDesigner.IsEditable)
            {
                IDataObject dataObject = Clipboard.GetDataObject();
                ICollection activities = null;
                try
                {
                    activities = CompositeActivityDesigner.DeserializeActivitiesFromDataObject(this.serviceProvider, dataObject, true);
                }
                catch (Exception exception)
                {
                    if (exception != CheckoutException.Canceled)
                    {
                        throw new Exception(DR.GetString("ActivityInsertError", new object[0]) + "\n" + exception.Message, exception);
                    }
                }
                if (activities == null)
                {
                    throw new InvalidOperationException(DR.GetString("InvalidOperationBadClipboardFormat", new object[0]));
                }
                System.Workflow.ComponentModel.Design.HitTestInfo insertLocation = null;
                if (primarySelection is System.Workflow.ComponentModel.Design.HitTestInfo)
                {
                    insertLocation = (System.Workflow.ComponentModel.Design.HitTestInfo)primarySelection;
                }
                else if (primarySelection is CompositeActivity)
                {
                    insertLocation = new System.Workflow.ComponentModel.Design.HitTestInfo(parentDesigner, HitTestLocations.Designer);
                }
                else if (primarySelection is Activity)
                {
                    Activity                  item     = primarySelection as Activity;
                    CompositeActivity         parent   = item.Parent;
                    CompositeActivityDesigner designer = ActivityDesigner.GetDesigner(parent) as CompositeActivityDesigner;
                    if (designer != null)
                    {
                        insertLocation = new ConnectorHitTestInfo(designer, HitTestLocations.Designer, parent.Activities.IndexOf(item) + 1);
                    }
                }
                List <Activity> list = new List <Activity>(Helpers.GetTopLevelActivities(activities));
                if ((insertLocation == null) || !parentDesigner.CanInsertActivities(insertLocation, list.AsReadOnly()))
                {
                    throw new Exception(SR.GetString("Error_NoPasteSupport"));
                }
                IExtendedUIService service = this.serviceProvider.GetService(typeof(IExtendedUIService)) as IExtendedUIService;
                if (service != null)
                {
                    foreach (Activity activity3 in activities)
                    {
                        service.AddAssemblyReference(activity3.GetType().Assembly.GetName());
                    }
                }
                CompositeActivityDesigner.InsertActivities(parentDesigner, insertLocation, list.AsReadOnly(), SR.GetString("PastingActivities"));
                Stream data = dataObject.GetData("CF_WINOEDESIGNERCOMPONENTSSTATE") as Stream;
                if (data != null)
                {
                    Helpers.DeserializeDesignersFromStream(activities, data);
                }
                this.selectionService.SetSelectedComponents(list.ToArray(), SelectionTypes.Replace);
                this.workflowView.EnsureVisible(this.selectionService.PrimarySelection);
            }
        }
        protected override bool OnDragEnter(DragEventArgs eventArgs)
        {
            WorkflowView parentView = base.ParentView;

            parentView.InvalidateClientRectangle(Rectangle.Empty);
            eventArgs.Effect       = DragDropEffects.None;
            this.wasCtrlKeyPressed = false;
            if (this.existingDraggedActivities.Count > 0)
            {
                this.draggedActivities.AddRange(this.existingDraggedActivities);
            }
            else
            {
                try
                {
                    Activity[] collection = CompositeActivityDesigner.DeserializeActivitiesFromDataObject(base.ParentView, eventArgs.Data);
                    if (collection != null)
                    {
                        this.draggedActivities.AddRange(collection);
                    }
                }
                catch
                {
                    this.exceptionInDragDrop = true;
                }
            }
            Point clientPoint = parentView.PointToClient(new Point(eventArgs.X, eventArgs.Y));
            Point point       = parentView.ScreenPointToLogical(new Point(eventArgs.X, eventArgs.Y));

            this.CreateDragFeedbackImages(this.draggedActivities);
            if (this.dragImage != null)
            {
                this.dragImagePointInClientCoOrd = new Point(clientPoint.X + (SystemInformation.CursorSize.Width / 4), clientPoint.Y + (SystemInformation.CursorSize.Height / 4));
            }
            if (!parentView.IsClientPointInActiveLayout(clientPoint))
            {
                return(false);
            }
            this.wasCtrlKeyPressed = (eventArgs.KeyState & 8) == 8;
            ActivityDragEventArgs e = new ActivityDragEventArgs(eventArgs, this.dragInitiationPoint, point, this.draggedActivities);
            ActivityDesigner      associatedDesigner = base.MessageHitTestContext.AssociatedDesigner;

            if (associatedDesigner == null)
            {
                return(false);
            }
            if (!this.wasCtrlKeyPressed && this.IsRecursiveDropOperation(associatedDesigner))
            {
                return(false);
            }
            CompositeActivityDesigner designer2 = associatedDesigner as CompositeActivityDesigner;

            if ((designer2 != null) && !designer2.IsEditable)
            {
                return(false);
            }
            this.dropTargetDesigner = associatedDesigner;
            ((IWorkflowDesignerMessageSink)this.dropTargetDesigner).OnDragEnter(e);
            if (!e.DragImageSnapPoint.IsEmpty)
            {
                Point point3 = parentView.LogicalPointToClient(e.DragImageSnapPoint);
                Size  size   = parentView.LogicalSizeToClient(AmbientTheme.DragImageIconSize);
                this.dragImagePointInClientCoOrd = new Point(point3.X - (size.Width / 2), point3.Y - (size.Height / 2));
                this.dragImageSnapped            = true;
            }
            eventArgs.Effect = e.Effect;
            if ((eventArgs.Effect == DragDropEffects.None) && this.exceptionInDragDrop)
            {
                eventArgs.Effect = this.wasCtrlKeyPressed ? DragDropEffects.Copy : DragDropEffects.Move;
            }
            return(true);
        }
        protected override bool OnDragDrop(DragEventArgs eventArgs)
        {
            WorkflowView parentView = base.ParentView;

            parentView.InvalidateClientRectangle(Rectangle.Empty);
            eventArgs.Effect = DragDropEffects.None;
            this.DestroyDragFeedbackImages();
            Point clientPoint = parentView.PointToClient(new Point(eventArgs.X, eventArgs.Y));
            Point point       = parentView.ScreenPointToLogical(new Point(eventArgs.X, eventArgs.Y));

            if (!parentView.IsClientPointInActiveLayout(clientPoint))
            {
                if (this.dropTargetDesigner != null)
                {
                    ((IWorkflowDesignerMessageSink)this.dropTargetDesigner).OnDragLeave();
                }
                this.wasCtrlKeyPressed  = false;
                this.dropTargetDesigner = null;
                this.draggedActivities.Clear();
                return(false);
            }
            this.wasCtrlKeyPressed = (eventArgs.KeyState & 8) == 8;
            ActivityDragEventArgs e = new ActivityDragEventArgs(eventArgs, this.dragInitiationPoint, point, this.draggedActivities);

            System.Workflow.ComponentModel.Design.HitTestInfo messageHitTestContext = base.MessageHitTestContext;
            if (this.dropTargetDesigner != messageHitTestContext.AssociatedDesigner)
            {
                if (this.dropTargetDesigner != null)
                {
                    ((IWorkflowDesignerMessageSink)this.dropTargetDesigner).OnDragLeave();
                    this.dropTargetDesigner = null;
                }
                if (messageHitTestContext.AssociatedDesigner != null)
                {
                    this.dropTargetDesigner = messageHitTestContext.AssociatedDesigner;
                    if (this.dropTargetDesigner != null)
                    {
                        ((IWorkflowDesignerMessageSink)this.dropTargetDesigner).OnDragEnter(e);
                    }
                }
            }
            try
            {
                if (this.dropTargetDesigner != null)
                {
                    if ((!this.wasCtrlKeyPressed && this.IsRecursiveDropOperation(this.dropTargetDesigner)) || ((this.dropTargetDesigner is CompositeActivityDesigner) && !((CompositeActivityDesigner)this.dropTargetDesigner).IsEditable))
                    {
                        ((IWorkflowDesignerMessageSink)this.dropTargetDesigner).OnDragLeave();
                        e.Effect = DragDropEffects.None;
                    }
                    else
                    {
                        List <Activity> draggedActivities = new List <Activity>();
                        string          description       = SR.GetString("DragDropActivities");
                        if (!this.wasCtrlKeyPressed && (this.existingDraggedActivities.Count > 0))
                        {
                            draggedActivities.AddRange(this.existingDraggedActivities);
                            if (draggedActivities.Count > 1)
                            {
                                description = SR.GetString("MoveMultipleActivities", new object[] { draggedActivities.Count });
                            }
                            else if (draggedActivities.Count == 1)
                            {
                                description = SR.GetString("MoveSingleActivity", new object[] { draggedActivities[0].GetType() });
                            }
                        }
                        else
                        {
                            draggedActivities.AddRange(CompositeActivityDesigner.DeserializeActivitiesFromDataObject(base.ParentView, eventArgs.Data, true));
                            if (draggedActivities.Count > 0)
                            {
                                description = SR.GetString("CreateActivityFromToolbox", new object[] { draggedActivities[0].GetType() });
                            }
                        }
                        IDesignerHost       host        = base.GetService(typeof(IDesignerHost)) as IDesignerHost;
                        DesignerTransaction transaction = null;
                        if (draggedActivities.Count > 0)
                        {
                            transaction = host.CreateTransaction(description);
                        }
                        e = new ActivityDragEventArgs(eventArgs, this.dragInitiationPoint, point, draggedActivities);
                        try
                        {
                            ((IWorkflowDesignerMessageSink)this.dropTargetDesigner).OnDragDrop(e);
                            if (e.Effect == DragDropEffects.Move)
                            {
                                this.existingDraggedActivities.Clear();
                            }
                            if (transaction != null)
                            {
                                transaction.Commit();
                            }
                        }
                        catch (Exception exception)
                        {
                            if (transaction != null)
                            {
                                transaction.Cancel();
                            }
                            throw exception;
                        }
                        if (draggedActivities.Count > 0)
                        {
                            Stream data = eventArgs.Data.GetData("CF_WINOEDESIGNERCOMPONENTSSTATE") as Stream;
                            if (data != null)
                            {
                                Helpers.DeserializeDesignersFromStream(draggedActivities, data);
                            }
                            ISelectionService service = (ISelectionService)base.GetService(typeof(ISelectionService));
                            if (service != null)
                            {
                                service.SetSelectedComponents(draggedActivities, SelectionTypes.Replace);
                            }
                        }
                        if (host != null)
                        {
                            host.Activate();
                        }
                    }
                }
            }
            catch (Exception exception2)
            {
                ((IWorkflowDesignerMessageSink)this.dropTargetDesigner).OnDragLeave();
                e.Effect = DragDropEffects.None;
                string message = exception2.Message;
                if ((exception2.InnerException != null) && !string.IsNullOrEmpty(exception2.InnerException.Message))
                {
                    message = exception2.InnerException.Message;
                }
                string str3 = DR.GetString("Error_FailedToDeserializeComponents", new object[0]) + "\r\n" + DR.GetString("Error_Reason", new object[] { message });
                DesignerHelpers.ShowError(base.ParentView, str3);
                if (exception2 != CheckoutException.Canceled)
                {
                    throw new Exception(str3, exception2);
                }
            }
            finally
            {
                this.wasCtrlKeyPressed = false;
                this.draggedActivities.Clear();
                this.dropTargetDesigner  = null;
                this.exceptionInDragDrop = false;
                eventArgs.Effect         = e.Effect;
            }
            return(true);
        }