Ejemplo n.º 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);
        }
Ejemplo n.º 2
0
            protected override void Initialize()
            {
                base.Initialize();

                ServiceCreatorCallback callback = new ServiceCreatorCallback(OnCreateService);

                LoaderHost.RemoveService(typeof(IReferenceService));
                LoaderHost.AddService(typeof(IReferenceService), callback);
            }
Ejemplo n.º 3
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();
        }