Esempio n. 1
0
        public void AddActivityToDesigner(Activity activity)
        {
            if (activity == null)
            {
                throw new ArgumentNullException("activity");
            }
            IDesignerHost service = base.GetService(typeof(IDesignerHost)) as IDesignerHost;

            if (service == null)
            {
                throw new InvalidOperationException(SR.GetString("General_MissingService", new object[] { typeof(IDesignerHost).FullName }));
            }
            if ((activity.Parent == null) && (service.RootComponent == null))
            {
                string str  = activity.GetValue(WorkflowMarkupSerializer.XClassProperty) as string;
                string name = !string.IsNullOrEmpty(str) ? Helpers.GetClassName(str) : Helpers.GetClassName(activity.GetType().FullName);
                service.Container.Add(activity, name);
                this.AddTargetFrameworkProvider(activity);
            }
            else
            {
                service.Container.Add(activity, activity.QualifiedName);
                this.AddTargetFrameworkProvider(activity);
            }
            if (activity is CompositeActivity)
            {
                foreach (Activity activity2 in Helpers.GetNestedActivities(activity as CompositeActivity))
                {
                    service.Container.Add(activity2, activity2.QualifiedName);
                    this.AddTargetFrameworkProvider(activity2);
                }
            }
        }
        internal static void UpdateSiteName(Activity activity, string newID)
        {
            if (activity == null)
            {
                throw new ArgumentException("activity");
            }
            string str = newID;

            if (Helpers.IsActivityLocked(activity))
            {
                str = InternalHelpers.GenerateQualifiedNameForLockedActivity(activity, newID);
            }
            activity.Site.Name = str;
            if (activity is CompositeActivity)
            {
                foreach (Activity activity2 in Helpers.GetNestedActivities(activity as CompositeActivity))
                {
                    if (Helpers.IsActivityLocked(activity2))
                    {
                        Activity declaringActivity = Helpers.GetDeclaringActivity(activity2);
                        activity2.Site.Name = declaringActivity.Site.Name + "." + activity2.Name;
                    }
                }
            }
        }
        private void OnMenuSelectAll(object sender, EventArgs e)
        {
            ActivityDesigner safeRootDesigner = ActivityDesigner.GetSafeRootDesigner(this.serviceProvider);

            if (safeRootDesigner != null)
            {
                List <Activity> list = new List <Activity>();
                if (safeRootDesigner.Activity is CompositeActivity)
                {
                    list.AddRange(Helpers.GetNestedActivities(safeRootDesigner.Activity as CompositeActivity));
                }
                this.selectionService.SetSelectedComponents(list.ToArray(), SelectionTypes.Replace);
            }
        }
Esempio n. 4
0
        public void RemoveActivityFromDesigner(Activity activity)
        {
            if (activity == null)
            {
                throw new ArgumentNullException("activity");
            }
            IDesignerHost service = base.GetService(typeof(IDesignerHost)) as IDesignerHost;

            if (service == null)
            {
                throw new InvalidOperationException(SR.GetString("General_MissingService", new object[] { typeof(IDesignerHost).FullName }));
            }
            service.DestroyComponent(activity);
            if (activity is CompositeActivity)
            {
                foreach (Activity activity2 in Helpers.GetNestedActivities(activity as CompositeActivity))
                {
                    service.DestroyComponent(activity2);
                }
            }
        }
Esempio n. 5
0
        public void RemoveActivityFromDesigner(Activity activity)
        {
            if (activity == null)
            {
                throw new ArgumentNullException("activity");
            }

            IDesignerHost designerHost = GetService(typeof(IDesignerHost)) as IDesignerHost;

            if (designerHost == null)
            {
                throw new InvalidOperationException(SR.GetString(SR.General_MissingService, typeof(IDesignerHost).FullName));
            }

            designerHost.DestroyComponent(activity);
            if (activity is CompositeActivity)
            {
                foreach (Activity activity2 in Helpers.GetNestedActivities(activity as CompositeActivity))
                {
                    designerHost.DestroyComponent(activity2);
                }
            }
        }
Esempio n. 6
0
        public void AddActivityToDesigner(Activity activity)
        {
            if (activity == null)
            {
                throw new ArgumentNullException("activity");
            }

            IDesignerHost designerHost = GetService(typeof(IDesignerHost)) as IDesignerHost;

            if (designerHost == null)
            {
                throw new InvalidOperationException(SR.GetString(SR.General_MissingService, typeof(IDesignerHost).FullName));
            }

            if (activity.Parent == null && designerHost.RootComponent == null)
            {
                string fullClassName = activity.GetValue(WorkflowMarkupSerializer.XClassProperty) as String;
                string rootSiteName  = (!string.IsNullOrEmpty(fullClassName)) ? Helpers.GetClassName(fullClassName) : Helpers.GetClassName(activity.GetType().FullName);
                designerHost.Container.Add(activity, rootSiteName);
                AddTargetFrameworkProvider(activity);
            }
            else
            {
                designerHost.Container.Add(activity, activity.QualifiedName);
                AddTargetFrameworkProvider(activity);
            }

            if (activity is CompositeActivity)
            {
                foreach (Activity activity2 in Helpers.GetNestedActivities(activity as CompositeActivity))
                {
                    designerHost.Container.Add(activity2, activity2.QualifiedName);
                    AddTargetFrameworkProvider(activity2);
                }
            }
        }