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);
        }
Beispiel #2
0
 protected override void Initialize( )
 {
     base.Initialize();
     if (this.TypeResolutionService != null && LoaderHost.GetService(typeof(ITypeResolutionService)) == null)
     {
         LoaderHost.AddService(typeof(ITypeResolutionService), this.TypeResolutionService);
     }
 }
Beispiel #3
0
            protected override void Initialize()
            {
                base.Initialize();

                ServiceCreatorCallback callback = new ServiceCreatorCallback(OnCreateService);

                LoaderHost.RemoveService(typeof(IReferenceService));
                LoaderHost.AddService(typeof(IReferenceService), callback);
            }
Beispiel #4
0
        object IDesignerSerializationService.Serialize(ICollection objects)
        {
            IDesignerSerializationService service = LoaderHost.GetService(typeof(IDesignerSerializationService)) as IDesignerSerializationService;

            if (service != null)
            {
                return(service.Serialize(objects));
            }
            return(null);
        }
Beispiel #5
0
        ICollection IDesignerSerializationService.Deserialize(object serializationData)
        {
            IDesignerSerializationService service = LoaderHost.GetService(typeof(IDesignerSerializationService)) as IDesignerSerializationService;

            if (service != null)
            {
                return(service.Deserialize(serializationData));
            }
            return(new object[0]);
        }
        /// <summary>
        /// Gets the resource writer for the specified culture.
        /// </summary>
        public IResourceWriter GetResourceWriter(CultureInfo info)
        {
            IResourceService resourceService = (IResourceService)LoaderHost.GetService(typeof(IResourceService));

            if (resourceService != null)
            {
                return(resourceService.GetResourceWriter(info));
            }
            return(null);
        }
        ICollection IDesignerSerializationService.Deserialize(object serializationData)
        {
            if (serializationData == null)
            {
                throw new ArgumentNullException("serializationData");
            }

            ComponentSerializationService service = LoaderHost.GetService(typeof(ComponentSerializationService)) as ComponentSerializationService;
            SerializationStore            store   = serializationData as SerializationStore;

            if (service != null && serializationData != null)
            {
                return(service.Deserialize(store, this.LoaderHost.Container));
            }
            return(new object[0]);
        }
Beispiel #8
0
        /// <summary>
        /// Creates a control corresponding to the serialization object passed.
        /// </summary>
        /// <param name="serializationObject">The serialization object.</param>
        /// <param name="parent">parent control</param>
        /// <param name="inherited">true if the control is inherited (should be locked)</param>
        /// <returns></returns>
        private ISerializableControl CreateControl(SerializationObject serializationObject, Control parent, bool inherited)
        {
            Type controlType = GetControlType(serializationObject);

            if (controlType == null)
            {
                return(null);
            }

            IComponent           component = LoaderHost.CreateComponent(controlType);
            ISerializableControl iControl  = (ISerializableControl)component;

            iControl.DesignerLoader      = this;
            iControl.SerializationObject = serializationObject;

            LayoutFrameType layoutFrameType = serializationObject as LayoutFrameType;

            if (layoutFrameType != null)
            {
                if (!inherited)
                {
                    component.Site.Name = layoutFrameType.ExpandedName;
                }

                BaseControl control = iControl as BaseControl;
                if (control != null)
                {
                    control.Inherited = inherited;
                    Size size = layoutFrameType.SizeInPixels;
                    if (!size.IsEmpty)
                    {
                        control.Size = size;
                    }
                    else
                    {
                        control.SetDefaultSize();
                    }

                    if (parent != null)
                    {
                        control.Parent = parent;
                    }
                }
            }

            return(iControl);
        }
        protected override void Initialize()
        {
            base.Initialize();
            base.LoaderHost.AddService(typeof(IDesignerSerializationService), this);
            base.LoaderHost.AddService(typeof(INameCreationService), this);
            base.LoaderHost.AddService(typeof(ComponentSerializationService), new
                                       CodeDomComponentSerializationService(base.LoaderHost));
            if (this.TypeResolutionService != null &&
                LoaderHost.GetService(typeof(ITypeResolutionService)) == null)
            {
                LoaderHost.AddService(typeof(ITypeResolutionService), this.TypeResolutionService);
            }
            IDesignerSerializationManager manager = base.LoaderHost.GetService(typeof(IDesignerSerializationManager)) as IDesignerSerializationManager;

            if (manager != null)
            {
                manager.AddSerializationProvider(CodeDomSerializationProvider.Instance);
            }
        }
Beispiel #10
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();
        }
        object IDesignerSerializationService.Serialize(ICollection objects)
        {
            if (objects == null)
            {
                throw new ArgumentNullException("objects");
            }

            ComponentSerializationService service = LoaderHost.GetService(typeof(ComponentSerializationService)) as ComponentSerializationService;

            if (service != null)
            {
                SerializationStore store = service.CreateStore();
                foreach (object o in objects)
                {
                    service.Serialize(store, o);
                }
                store.Close();
                return(store);
            }
            return(null);
        }
 bool GetResourceService()
 {
     resourceService = (IResourceService)LoaderHost.GetService(typeof(IResourceService));
     return(resourceService != null);
 }