Example #1
0
        protected override void Initialize()
        {
            base.Initialize();

            //PLEASE NOTE THE FOLLOWING CODE IS ADDED TO MAKE THE SPECIFIC DESIGNER TYPE INTERNAL
            //This is a work around for invoke workflow so that the ActivityHostDesignerType does not become public
            //Please refer to file WorkflowInlining.cs
            Type invokeWorkflowType = Type.GetType(InvokeWorkflowDesigner.InvokeWorkflowRef);

            if (invokeWorkflowType != null)
            {
                TypeDescriptor.AddAttributes(invokeWorkflowType, new DesignerAttribute(typeof(InvokeWorkflowDesigner), typeof(IDesigner)));
            }

            //Add all the services, it is important to make sure that if user pushes the services then we honor
            //those services
            LoaderHost.AddService(typeof(WorkflowDesignerLoader), this);

            ServiceCreatorCallback callback = new ServiceCreatorCallback(OnCreateService);

            if (LoaderHost.GetService(typeof(IWorkflowCompilerOptionsService)) == null)
            {
                LoaderHost.AddService(typeof(IWorkflowCompilerOptionsService), callback);
            }

            if (LoaderHost.GetService(typeof(IIdentifierCreationService)) == null)
            {
                LoaderHost.AddService(typeof(IIdentifierCreationService), callback);
            }

            if (LoaderHost.GetService(typeof(ComponentSerializationService)) == null)
            {
                LoaderHost.AddService(typeof(ComponentSerializationService), callback);
            }

            LoaderHost.RemoveService(typeof(IReferenceService));
            if (LoaderHost.GetService(typeof(IReferenceService)) == null)
            {
                LoaderHost.AddService(typeof(IReferenceService), callback);
            }

            if (LoaderHost.GetService(typeof(IDesignerVerbProviderService)) == null)
            {
                LoaderHost.AddService(typeof(IDesignerVerbProviderService), callback);
            }

            //Add all the extenders, the extenders are responsible to add the extended properties which are not
            //actual properties on activity
            IExtenderProviderService extenderProviderService = GetService(typeof(IExtenderProviderService)) as IExtenderProviderService;

            if (extenderProviderService != null)
            {
                foreach (IExtenderProvider extender in ComponentDispenser.Extenders)
                {
                    extenderProviderService.AddExtenderProvider(extender);
                }
            }

            this.customActivityDesignerAdapter = new CustomActivityDesignerAdapter(LoaderHost);
        }
Example #2
0
        protected override void Initialize()
        {
            base.Initialize();
            Type type = Type.GetType("System.Workflow.Activities.InvokeWorkflowActivity, System.Workflow.Activities, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35");

            if (type != null)
            {
                TypeDescriptor.AddAttributes(type, new Attribute[] { new DesignerAttribute(typeof(InvokeWorkflowDesigner), typeof(IDesigner)) });
            }
            base.LoaderHost.AddService(typeof(WorkflowDesignerLoader), this);
            ServiceCreatorCallback callback = new ServiceCreatorCallback(this.OnCreateService);

            if (base.LoaderHost.GetService(typeof(IWorkflowCompilerOptionsService)) == null)
            {
                base.LoaderHost.AddService(typeof(IWorkflowCompilerOptionsService), callback);
            }
            if (base.LoaderHost.GetService(typeof(IIdentifierCreationService)) == null)
            {
                base.LoaderHost.AddService(typeof(IIdentifierCreationService), callback);
            }
            if (base.LoaderHost.GetService(typeof(ComponentSerializationService)) == null)
            {
                base.LoaderHost.AddService(typeof(ComponentSerializationService), callback);
            }
            base.LoaderHost.RemoveService(typeof(IReferenceService));
            if (base.LoaderHost.GetService(typeof(IReferenceService)) == null)
            {
                base.LoaderHost.AddService(typeof(IReferenceService), callback);
            }
            if (base.LoaderHost.GetService(typeof(IDesignerVerbProviderService)) == null)
            {
                base.LoaderHost.AddService(typeof(IDesignerVerbProviderService), callback);
            }
            IExtenderProviderService service = base.GetService(typeof(IExtenderProviderService)) as IExtenderProviderService;

            if (service != null)
            {
                foreach (IExtenderProvider provider in ComponentDispenser.Extenders)
                {
                    service.AddExtenderProvider(provider);
                }
            }
            this.customActivityDesignerAdapter = new CustomActivityDesignerAdapter(base.LoaderHost);
        }
        protected override void Initialize()
        {
            base.Initialize();

            //PLEASE NOTE THE FOLLOWING CODE IS ADDED TO MAKE THE SPECIFIC DESIGNER TYPE INTERNAL
            //This is a work around for invoke workflow so that the ActivityHostDesignerType does not become public
            //Please refer to file WorkflowInlining.cs
            Type invokeWorkflowType = Type.GetType(InvokeWorkflowDesigner.InvokeWorkflowRef);
            if (invokeWorkflowType != null)
                TypeDescriptor.AddAttributes(invokeWorkflowType, new DesignerAttribute(typeof(InvokeWorkflowDesigner), typeof(IDesigner)));

            //Add all the services, it is important to make sure that if user pushes the services then we honor
            //those services
            LoaderHost.AddService(typeof(WorkflowDesignerLoader), this);

            ServiceCreatorCallback callback = new ServiceCreatorCallback(OnCreateService);
            if (LoaderHost.GetService(typeof(IWorkflowCompilerOptionsService)) == null)
                LoaderHost.AddService(typeof(IWorkflowCompilerOptionsService), callback);

            if (LoaderHost.GetService(typeof(IIdentifierCreationService)) == null)
                LoaderHost.AddService(typeof(IIdentifierCreationService), callback);

            if (LoaderHost.GetService(typeof(ComponentSerializationService)) == null)
                LoaderHost.AddService(typeof(ComponentSerializationService), callback);

            LoaderHost.RemoveService(typeof(IReferenceService));
            if (LoaderHost.GetService(typeof(IReferenceService)) == null)
                LoaderHost.AddService(typeof(IReferenceService), callback);

            if (LoaderHost.GetService(typeof(IDesignerVerbProviderService)) == null)
                LoaderHost.AddService(typeof(IDesignerVerbProviderService), callback);

            //Add all the extenders, the extenders are responsible to add the extended properties which are not
            //actual properties on activity
            IExtenderProviderService extenderProviderService = GetService(typeof(IExtenderProviderService)) as IExtenderProviderService;
            if (extenderProviderService != null)
            {
                foreach (IExtenderProvider extender in ComponentDispenser.Extenders)
                    extenderProviderService.AddExtenderProvider(extender);
            }

            this.customActivityDesignerAdapter = new CustomActivityDesignerAdapter(LoaderHost);
        }
Example #4
0
        public override void Dispose()
        {
            if (this.eventsCoordinator != null)
            {
                ((IDisposable)this.eventsCoordinator).Dispose();
                this.eventsCoordinator = null;
            }

            if (this.customActivityDesignerAdapter != null)
            {
                ((IDisposable)this.customActivityDesignerAdapter).Dispose();
                this.customActivityDesignerAdapter = null;
            }

            IExtenderProviderService extenderProviderService = GetService(typeof(IExtenderProviderService)) as IExtenderProviderService;

            if (extenderProviderService != null)
            {
                foreach (IExtenderProvider extender in ComponentDispenser.Extenders)
                {
                    extenderProviderService.RemoveExtenderProvider(extender);
                }
            }

            if (LoaderHost != null)
            {
                if (this.createdServices != null)
                {
                    foreach (Type serviceType in this.createdServices.Keys)
                    {
                        LoaderHost.RemoveService(serviceType);
                        OnDisposeService(serviceType, this.createdServices[serviceType]);
                    }
                    this.createdServices.Clear();
                    this.createdServices = null;
                }
                LoaderHost.RemoveService(typeof(WorkflowDesignerLoader));
            }

            base.Dispose();
        }
        public override void Dispose()
        {
            if (this.eventsCoordinator != null)
            {
                ((IDisposable)this.eventsCoordinator).Dispose();
                this.eventsCoordinator = null;
            }

            if (this.customActivityDesignerAdapter != null)
            {
                ((IDisposable)this.customActivityDesignerAdapter).Dispose();
                this.customActivityDesignerAdapter = null;
            }

            IExtenderProviderService extenderProviderService = GetService(typeof(IExtenderProviderService)) as IExtenderProviderService;
            if (extenderProviderService != null)
            {
                foreach (IExtenderProvider extender in ComponentDispenser.Extenders)
                    extenderProviderService.RemoveExtenderProvider(extender);
            }

            if (LoaderHost != null)
            {
                if (this.createdServices != null)
                {
                    foreach (Type serviceType in this.createdServices.Keys)
                    {
                        LoaderHost.RemoveService(serviceType);
                        OnDisposeService(serviceType, this.createdServices[serviceType]);
                    }
                    this.createdServices.Clear();
                    this.createdServices = null;
                }
                LoaderHost.RemoveService(typeof(WorkflowDesignerLoader));
            }

            base.Dispose();
        }
 protected override void Initialize()
 {
     base.Initialize();
     Type type = Type.GetType("System.Workflow.Activities.InvokeWorkflowActivity, System.Workflow.Activities, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35");
     if (type != null)
     {
         TypeDescriptor.AddAttributes(type, new Attribute[] { new DesignerAttribute(typeof(InvokeWorkflowDesigner), typeof(IDesigner)) });
     }
     base.LoaderHost.AddService(typeof(WorkflowDesignerLoader), this);
     ServiceCreatorCallback callback = new ServiceCreatorCallback(this.OnCreateService);
     if (base.LoaderHost.GetService(typeof(IWorkflowCompilerOptionsService)) == null)
     {
         base.LoaderHost.AddService(typeof(IWorkflowCompilerOptionsService), callback);
     }
     if (base.LoaderHost.GetService(typeof(IIdentifierCreationService)) == null)
     {
         base.LoaderHost.AddService(typeof(IIdentifierCreationService), callback);
     }
     if (base.LoaderHost.GetService(typeof(ComponentSerializationService)) == null)
     {
         base.LoaderHost.AddService(typeof(ComponentSerializationService), callback);
     }
     base.LoaderHost.RemoveService(typeof(IReferenceService));
     if (base.LoaderHost.GetService(typeof(IReferenceService)) == null)
     {
         base.LoaderHost.AddService(typeof(IReferenceService), callback);
     }
     if (base.LoaderHost.GetService(typeof(IDesignerVerbProviderService)) == null)
     {
         base.LoaderHost.AddService(typeof(IDesignerVerbProviderService), callback);
     }
     IExtenderProviderService service = base.GetService(typeof(IExtenderProviderService)) as IExtenderProviderService;
     if (service != null)
     {
         foreach (IExtenderProvider provider in ComponentDispenser.Extenders)
         {
             service.AddExtenderProvider(provider);
         }
     }
     this.customActivityDesignerAdapter = new CustomActivityDesignerAdapter(base.LoaderHost);
 }