示例#1
0
        /// <summary>
        /// Initialize the workflow designer loader
        /// </summary>
        protected override void Initialize()
        {
            base.Initialize();

            //add any necessary services
            IDesignerLoaderHost host = LoaderHost;

            if (host != null)
            {
                //add the custom MenuCommandService
                host.AddService(
                    typeof(IMenuCommandService),
                    new WorkflowMenuService(host));

                //add the TypeProvider
                host.AddService(
                    typeof(ITypeProvider), _typeProvider, true);

                //add the toolbox service
                _toolboxService = new WorkflowToolboxService(host);
                host.AddService(
                    typeof(IToolboxService), _toolboxService);

                //add the property value UI service
                host.AddService(
                    typeof(IPropertyValueUIService),
                    new WorkflowPropertyValueService());

                //add the event binding service
                host.AddService(
                    typeof(IEventBindingService),
                    new WorkflowEventBindingService(host));
            }
        }
 public override void BeginLoad(IDesignerLoaderHost host)
 {
     string baseClassName;
     if (host == null)
     {
         throw new ArgumentNullException("SampleDesignerLoader.BeginLoad: Invalid designerLoaderHost.");
     }
     this.host = host;
     ArrayList errors = new ArrayList();
     bool successful = true;
     host.AddService(typeof(IDesignerSerializationManager), new SampleDesignerSerializationManager(this));
     host.AddService(typeof(IEventBindingService), new SampleEventBindingService(host));
     host.AddService(typeof(ITypeResolutionService), new SampleTypeResolutionService());
     host.AddService(typeof(CodeDomProvider), new CSharpCodeProvider());
     host.AddService(typeof(IResourceService), new SampleResourceService(host));
     if (this.fileName == null)
     {
         baseClassName = host.CreateComponent(typeof(Form)).Site.Name;
     }
     else
     {
         baseClassName = this.ReadFile(this.fileName, errors, out this.xmlDocument);
     }
     IComponentChangeService cs = host.GetService(typeof(IComponentChangeService)) as IComponentChangeService;
     if (cs != null)
     {
         cs.ComponentChanged += new ComponentChangedEventHandler(this.OnComponentChanged);
         cs.ComponentAdded += new ComponentEventHandler(this.OnComponentAddedRemoved);
         cs.ComponentRemoved += new ComponentEventHandler(this.OnComponentAddedRemoved);
     }
     host.EndLoad(baseClassName, successful, errors);
     this.dirty = true;
     this.unsaved = false;
 }
 public override void BeginLoad(IDesignerLoaderHost host)
 {
     Debug.Assert(host != null);
     this.host = host;
     host.AddService(typeof(INameCreationService), new NameCreationService(host));
     host.AddService(typeof(ComponentSerializationService), new CodeDomComponentSerializationService((IServiceProvider)host));
     host.AddService(typeof(IDesignerSerializationService), new DesignerSerializationService((IServiceProvider)host));
     base.BeginLoad(host);
 }
		public override void BeginLoad(IDesignerLoaderHost host)
		{
			Debug.Assert(host != null);
			this.host = host;
			host.AddService(typeof(INameCreationService), new NameCreationService(host));
			host.AddService(typeof(ComponentSerializationService), new CodeDomComponentSerializationService((IServiceProvider)host));
			host.AddService(typeof(IDesignerSerializationService), new DesignerSerializationService((IServiceProvider)host));
			base.BeginLoad(host);
		}
示例#5
0
		public override void BeginLoad(IDesignerLoaderHost host)
		{
			if (host == null) {
				throw new ArgumentNullException("host");
			}
			this.host = host;
			host.AddService(typeof(ComponentSerializationService), new CodeDomComponentSerializationService((IServiceProvider)host));
			host.AddService(typeof(IDesignerSerializationService), new DesignerSerializationService((IServiceProvider)host));
			base.BeginLoad(host);
		}
示例#6
0
 public override void BeginLoad(IDesignerLoaderHost host)
 {
     if (host == null)
     {
         throw new ArgumentNullException("host");
     }
     this.host = host;
     host.AddService(typeof(ComponentSerializationService), new CodeDomComponentSerializationService((IServiceProvider)host));
     host.AddService(typeof(IDesignerSerializationService), new DesignerSerializationService((IServiceProvider)host));
     base.BeginLoad(host);
 }
        public override void BeginLoad(IDesignerLoaderHost host)
        {
            host.AddService(typeof(ComponentSerializationService), new CodeDomComponentSerializationService((IServiceProvider)host));
            host.AddService(typeof(INameCreationService), new RubyNameCreationService(host));
            host.AddService(typeof(IDesignerSerializationService), new DesignerSerializationService(host));

            ProjectResourceService projectResourceService = host.GetService(typeof(ProjectResourceService)) as ProjectResourceService;

            if (projectResourceService != null)
            {
                projectResourceService.DesignerSupportsProjectResources = false;
            }

            base.BeginLoad(host);
        }
示例#8
0
        protected override void Initialize()
        {
            base.Initialize();

            IDesignerLoaderHost host = LoaderHost;

            if (host != null)
            {
                host.RemoveService(typeof(IIdentifierCreationService));
                host.AddService(typeof(IIdentifierCreationService), new IdentifierCreationService(host));
                host.AddService(typeof(IMenuCommandService), new MenuCommandService(host));
                TypeProvider typeProvider = new TypeProvider(host);
                typeProvider.AddAssemblyReference(typeof(string).Assembly.Location);
                host.AddService(typeof(ITypeProvider), typeProvider, true);
                host.AddService(typeof(IEventBindingService), new EventBindingService());
            }
        }
		public override void BeginLoad(IDesignerLoaderHost host)
		{
			// Check dialog id.
			if (designer.DialogId == null) {
				throw new FormsDesignerLoadException(StringParser.Parse("${res:ICSharpCode.WixBinding.WixDialogDesigner.NoDialogSelectedInDocumentMessage}"));
			}
			
			// Get dialog element.
			WixDocument document = CreateWixDocument();
			document.LoadXml(designer.GetDocumentXml());
			wixDialog = document.GetDialog(designer.DialogId, new WorkbenchTextFileReader());
			if (wixDialog == null) {
				throw new FormsDesignerLoadException(String.Format(StringParser.Parse("${res:ICSharpCode.WixBinding.DialogDesignerGenerator.DialogIdNotFoundMessage}"), designer.DialogId));
			}
			
			host.AddService(typeof(ComponentSerializationService), new CodeDomComponentSerializationService((IServiceProvider)host));
			host.AddService(typeof(INameCreationService), new XmlDesignerLoader.NameCreationService(host));
			host.AddService(typeof(IDesignerSerializationService), new DesignerSerializationService(host));

			base.BeginLoad(host);
		}
示例#10
0
        protected override void Initialize()
        {
            base.Initialize();

            IDesignerLoaderHost host = LoaderHost;

            if (host != null)
            {
                TypeProvider typeProvider = new TypeProvider(host);
                typeProvider.AddAssemblyReference(typeof(string).Assembly.Location);
                host.AddService(typeof(ITypeProvider), typeProvider, true);
            }
        }
        public override void BeginLoad(IDesignerLoaderHost host)
        {
            string baseClassName;

            if (host == null)
            {
                throw new ArgumentNullException("SampleDesignerLoader.BeginLoad: Invalid designerLoaderHost.");
            }
            this.host = host;
            ArrayList errors     = new ArrayList();
            bool      successful = true;

            host.AddService(typeof(IDesignerSerializationManager), new SampleDesignerSerializationManager(this));
            host.AddService(typeof(IEventBindingService), new SampleEventBindingService(host));
            host.AddService(typeof(ITypeResolutionService), new SampleTypeResolutionService());
            host.AddService(typeof(CodeDomProvider), new CSharpCodeProvider());
            host.AddService(typeof(IResourceService), new SampleResourceService(host));
            if (this.fileName == null)
            {
                baseClassName = host.CreateComponent(typeof(Form)).Site.Name;
            }
            else
            {
                baseClassName = this.ReadFile(this.fileName, errors, out this.xmlDocument);
            }
            IComponentChangeService cs = host.GetService(typeof(IComponentChangeService)) as IComponentChangeService;

            if (cs != null)
            {
                cs.ComponentChanged += new ComponentChangedEventHandler(this.OnComponentChanged);
                cs.ComponentAdded   += new ComponentEventHandler(this.OnComponentAddedRemoved);
                cs.ComponentRemoved += new ComponentEventHandler(this.OnComponentAddedRemoved);
            }
            host.EndLoad(baseClassName, successful, errors);
            this.dirty   = true;
            this.unsaved = false;
        }
示例#12
0
        public override void BeginLoad(IDesignerLoaderHost host)
        {
            // Check dialog id.
            if (designer.DialogId == null)
            {
                throw new FormsDesignerLoadException(StringParser.Parse("${res:ICSharpCode.WixBinding.WixDialogDesigner.NoDialogSelectedInDocumentMessage}"));
            }

            // Get dialog element.
            WixDocument document = CreateWixDocument();

            document.LoadXml(designer.GetDocumentXml());
            wixDialog = document.GetDialog(designer.DialogId, new WorkbenchTextFileReader());
            if (wixDialog == null)
            {
                throw new FormsDesignerLoadException(String.Format(StringParser.Parse("${res:ICSharpCode.WixBinding.DialogDesignerGenerator.DialogIdNotFoundMessage}"), designer.DialogId));
            }

            host.AddService(typeof(ComponentSerializationService), new CodeDomComponentSerializationService((IServiceProvider)host));
            host.AddService(typeof(INameCreationService), new XmlDesignerLoader.NameCreationService(host));
            host.AddService(typeof(IDesignerSerializationService), new DesignerSerializationService(host));

            base.BeginLoad(host);
        }
            /// <include file='doc\DocumentManager.uex' path='docs/doc[@for="DocumentManager.ComponentDesignerLoader.BeginLoad"]/*' />
            /// <devdoc>
            ///     The host will call this method when it wants to load whatever
            ///     data the code stream contains.  There are three times when this
            ///     method can be called.  First, a code stream is handed to the
            ///     host to initially create the document, so load will be called there.
            ///     Second, when a code steam is first declared through IPersistenceService,
            ///     it will be loaded immediately.  Finally, if the document needs to be
            ///     re-loaded because the user changed one or more files, then all code
            ///     streams will be re-loaded.
            /// </devdoc>
            public override void BeginLoad(IDesignerLoaderHost host)
            {
                if (this.host == null)
                {
                    host.AddService(typeof(IDesignerLoaderService), this);
                }

                this.host = host;

                loadCount = 1;
                if (errorList == null)
                {
                    errorList = new ArrayList();
                }
                else
                {
                    errorList.Clear();
                }

                bool successful = true;

                if (host != null)
                {
                    Type c = host.GetType(componentClass);
                    if (c == null)
                    {
                        errorList.Add(new Exception(SR.GetString(SR.PersisterClassNotFound, componentClass)));
                    }
                    else
                    {
                        IComponent component = null;

                        try {
                            component = host.CreateComponent(c);
                        }
                        catch (Exception e) {
                            errorList.Add(e);
                            successful = false;
                        }
                    }
                    ((IDesignerLoaderService)this).DependentLoadComplete(successful, errorList);
                }
            }
示例#14
0
        protected override void Initialize()
        {
            base.Initialize();

            // Add all the services to the loaderhost
            IDesignerLoaderHost host = LoaderHost;

            if (host != null)
            {
                this.SetBaseComponentClassName("foo.Workflow1");
                host.AddService(typeof(IMenuCommandService), new WorkflowMenuCommandService(host));
                host.AddService(typeof(IToolboxService), new ToolboxService(host));
                TypeProvider typeProvider = new TypeProvider(host);
                //typeProvider.AddCodeCompileUnit(this.CodeBesideCCU);
                typeProvider.AddAssemblyReference(typeof(System.EventHandler).Assembly.Location);
                typeProvider.AddAssemblyReference(typeof(System.ComponentModel.AttributeCollection).Assembly.Location);
                typeProvider.AddAssemblyReference(typeof(System.Workflow.ComponentModel.CompositeActivity).Assembly.Location);
                typeProvider.AddAssemblyReference(typeof(System.Workflow.Activities.SequentialWorkflowActivity).Assembly.Location);
                host.AddService(typeof(ITypeProvider), typeProvider, true);
                host.AddService(typeof(IMemberCreationService), new MemberCreationService(host, this));
                host.AddService(typeof(IPropertyValueUIService), new PropertyValueUIService());
                host.AddService(typeof(IEventBindingService), new EventBindingService(host, this));
            }
        }
		// Called by the host when we load a document.
		public override void BeginLoad(IDesignerLoaderHost host) 
		{
			if (host == null) 
			{
				throw new ArgumentNullException("SampleDesignerLoader.BeginLoad: Invalid designerLoaderHost.");
			}

			this.host = host;

			// The loader will put error messages in here.
			//
			ArrayList errors = new ArrayList();
			bool successful = true;
			string baseClassName;
			
			// The loader is responsible for providing certain services to the host.
			//
			host.AddService(typeof(IDesignerSerializationManager), new SampleDesignerSerializationManager(this));
			host.AddService(typeof(IEventBindingService), new SampleEventBindingService(host));
			host.AddService(typeof(ITypeResolutionService), new SampleTypeResolutionService());
			host.AddService(typeof(CodeDomProvider), new CSharpCodeProvider());
			host.AddService(typeof(IResourceService), new SampleResourceService(host));

			// If no filename was passed in, just create a form and be done with it.  If a file name
			// was passed, read it.
			//
			if (fileName == null) 
			{
				baseClassName = host.CreateComponent(typeof(System.Windows.Forms.Form)).Site.Name;
			}
			else 
			{
				baseClassName = ReadFile(fileName, errors, out xmlDocument);
			}

			// Now that we are done with the load work, we need to begin to listen to events.
			// Listening to event notifications is how a designer "Loader" can also be used
			// to save data.  If we wanted to integrate this loader with source code control,
			// we would listen to the "ing" events as well as the "ed" events.
			//
			IComponentChangeService cs = host.GetService(typeof(IComponentChangeService)) as IComponentChangeService;
			if (cs != null)
			{
				cs.ComponentChanged += new ComponentChangedEventHandler(OnComponentChanged);
				cs.ComponentAdded += new ComponentEventHandler(OnComponentAddedRemoved);
				cs.ComponentRemoved += new ComponentEventHandler(OnComponentAddedRemoved);
			}

			// Let the host know we are done loading.
			host.EndLoad(baseClassName, successful, errors);
			
			// We've just loaded a document, so you can bet we need to flush changes.
			dirty = true;
			unsaved = false;
		}
		void AddServicesToHost(IDesignerLoaderHost host)
		{
			host.AddService(typeof(ComponentSerializationService), new CodeDomComponentSerializationService((IServiceProvider)host));
			host.AddService(typeof(INameCreationService), new XmlDesignerNameCreationService(host));
			host.AddService(typeof(IDesignerSerializationService), new DesignerSerializationService(host));
		}
 void AddServicesToHost(IDesignerLoaderHost host)
 {
     host.AddService(typeof(ComponentSerializationService), new CodeDomComponentSerializationService((IServiceProvider)host));
     host.AddService(typeof(INameCreationService), new XmlDesignerNameCreationService(host));
     host.AddService(typeof(IDesignerSerializationService), new DesignerSerializationService(host));
 }