예제 #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);
                }
            }
        }
예제 #2
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);
                }
            }
        }