/// <summary>
        /// Gets a new HostSurface and loads it with the appropriate type of
        /// root component. Uses the appropriate Loader to load the HostSurface.
        /// </summary>
        public HostControl GetNewHost(Type rootComponentType, LoaderType loaderType)
        {
            if (loaderType == LoaderType.NoLoader)
            {
                return(GetNewHost(rootComponentType));
            }

            HostSurface   hostSurface = (HostSurface)this.CreateDesignSurface(this.ServiceContainer);
            IDesignerHost host        = (IDesignerHost)hostSurface.GetService(typeof(IDesignerHost));

            switch (loaderType)
            {
            case LoaderType.BasicDesignerLoader:
                BasicHostLoader basicHostLoader = new BasicHostLoader(rootComponentType);
                hostSurface.BeginLoad(basicHostLoader);
                hostSurface.Loader = basicHostLoader;
                break;

            case LoaderType.CodeDomDesignerLoader:
                CodeDomHostLoader codeDomHostLoader = new CodeDomHostLoader();
                hostSurface.BeginLoad(codeDomHostLoader);
                hostSurface.Loader = codeDomHostLoader;
                break;

            default:
                throw new Exception("Loader is not defined: " + loaderType.ToString());
            }

            hostSurface.Initialize();
            return(new HostControl(hostSurface));
        }
Exemple #2
0
 public CSharpForm(HostSurfaceFactory hostSurfaceFactory, string name)
     : base(hostSurfaceFactory)
 {
     this.ServiceContainer.AddService(typeof(IMenuCommandService), new MenuCommandService(this));
     loader = new CodeDomHostLoader(name);
     this.BeginLoad(loader);
     ((Control)this.View).BackColor = Color.White;
     this.Loader = loader;
 }
Exemple #3
0
 public VBForm(HostSurfaceFactory hostSurfaceFactory, string name)
     : base(hostSurfaceFactory)
 {
     this.ServiceContainer.AddService(typeof(IMenuCommandService), new MenuCommandService(this));
     loader = new CodeDomHostLoader(name);
     this.BeginLoad(loader);
     ((Control)this.View).BackColor = Color.White;
     this.Loader = loader;
 }