public override bool CanInsertActivities(System.Workflow.ComponentModel.Design.HitTestInfo insertLocation, ReadOnlyCollection <Activity> activitiesToInsert)
        {
            if (insertLocation == null)
            {
                throw new ArgumentNullException("insertLocation");
            }
            if (activitiesToInsert == null)
            {
                throw new ArgumentNullException("activitiesToInsert");
            }
            ActivityDesigner designer = (this.ActiveView != null) ? this.ActiveView.AssociatedDesigner : null;

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

            foreach (Activity activity in activitiesToInsert)
            {
                if (activity == null)
                {
                    throw new ArgumentException("activitiesToInsert", SR.GetString("Error_CollectionHasNullEntry"));
                }
                if (activityTypes.Contains(activity.GetType()))
                {
                    return(false);
                }
            }
            return(base.CanInsertActivities(this.GetUpdatedLocation(insertLocation), activitiesToInsert));
        }
Exemplo n.º 2
0
        public override bool CanInsertActivities(HitTestInfo insertLocation, ReadOnlyCollection <Activity> activitiesToInsert)
        {
            if (insertLocation == null)
            {
                throw new ArgumentNullException("insertLocation");
            }

            if (activitiesToInsert == null)
            {
                throw new ArgumentNullException("activitiesToInsert");
            }

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

            if (hostedDesigner != this)
            {
                return(false);
            }

            IList <Type> secondaryViewTypes = SecondaryViewProvider.GetActivityTypes(this);

            foreach (Activity activity in activitiesToInsert)
            {
                if (activity == null)
                {
                    throw new ArgumentException("activitiesToInsert", SR.GetString(SR.Error_CollectionHasNullEntry));
                }

                if (secondaryViewTypes.Contains(activity.GetType()))
                {
                    return(false);
                }
            }

            return(base.CanInsertActivities(GetUpdatedLocation(insertLocation), activitiesToInsert));
        }