예제 #1
0
        public DesignerControler GetNewHost(Type rootComponentType)
        {
            ControlerSurface hostSurface = (ControlerSurface)this.CreateDesignSurface(this.ServiceContainer);
            IDesignerHost    host        = (IDesignerHost)hostSurface.GetService(typeof(IDesignerHost));

            BasicDesignerViewer basicHostLoader = new BasicDesignerViewer(rootComponentType);

            hostSurface.BeginLoad(basicHostLoader);
            hostSurface.Loader = basicHostLoader;
            return(new DesignerControler(hostSurface));
        }
예제 #2
0
        public DesignerControler GetNewHost(string fileName)
        {
            if (fileName == null || !File.Exists(fileName))
            {
                MessageBox.Show("FileName is incorrect: " + fileName);
            }
            ControlerSurface hostSurface = (ControlerSurface)this.CreateDesignSurface(this.ServiceContainer);
            IDesignerHost    host        = (IDesignerHost)hostSurface.GetService(typeof(IDesignerHost));

            BasicDesignerViewer basicHostLoader = new BasicDesignerViewer(fileName);

            hostSurface.BeginLoad(basicHostLoader);
            hostSurface.Loader = basicHostLoader;
            hostSurface.Initialize();
            return(new DesignerControler(hostSurface));
        }