Beispiel #1
0
 /// <summary>
 /// CTOR
 /// </summary>
 /// <param name="host"></param>
 /// <param name="createAllOwnerDrawControlsDelegate"></param>
 /// <param name="getControlDesignerInfo"></param>
 internal ControlFactory(IDesignerLoaderHost host,
                         CreateAllOwnerDrawControlsDelegate createAllOwnerDrawControlsDelegate,
                         GetControlDesignerInfoDelegate getControlDesignerInfo,
                         RuntimeHostSurface runtimeHostSurface)
 {
     this.host = host;
     this.createAllOwnerDrawControls = createAllOwnerDrawControlsDelegate;
     this.getControlDesignerInfo     = getControlDesignerInfo;
     this.runtimeHostSurface         = runtimeHostSurface;
 }
Beispiel #2
0
 /// Empty constructor simply creates a new form.
 internal RuntimeHostLoader(Type rootComponentType, Form formToClone,
                            CreateAllOwnerDrawControlsDelegate createAllOwnerDrawControls,
                            GetControlDesignerInfoDelegate getControlDesignerInfo,
                            RuntimeHostSurface hostSurface)
 {
     this.rootComponentType          = rootComponentType;
     this.Modified                   = true;
     this.formToClone                = formToClone;
     this.createAllOwnerDrawControls = createAllOwnerDrawControls;
     this.getControlDesignerInfo     = getControlDesignerInfo;
     this.runtimeHostSurface         = hostSurface;
 }
        /// <summary>
        /// Gets a new HostSurface and loads it with the appropriate type of
        /// root component. Uses the appropriate Loader to load the HostSurface.
        /// </summary>
        internal RuntimeHostControl GetNewHost(Form form, CreateAllOwnerDrawControlsDelegate createAllOwnerDrawControls,
                                               GetControlDesignerInfoDelegate getControlDesignerInfo, bool adminMode, ITranslate translate)
        {
            this.translate = translate;
            RuntimeHostSurface hostSurface     = (RuntimeHostSurface)this.CreateDesignSurface(this.ServiceContainer);
            IDesignerHost      host            = (IDesignerHost)hostSurface.GetService(typeof(IDesignerHost));
            RuntimeHostLoader  basicHostLoader = new RuntimeHostLoader(typeof(Form), form, createAllOwnerDrawControls, getControlDesignerInfo,
                                                                       hostSurface);

            hostSurface.AdminMode = adminMode;
            hostSurface.BeginLoad(basicHostLoader);
            hostSurface.Loader = basicHostLoader;
            hostSurface.Initialize();
            this.ActiveDesignSurface = hostSurface;
            return(new RuntimeHostControl(hostSurface));
        }
Beispiel #4
0
        public void AddDesigner(Form form, CreateAllOwnerDrawControlsDelegate createAllOwnerDrawControls, GetControlDesignerInfoDelegate getControlDesignerInfo)
        {
            RuntimeHostControl hc = _hostSurfaceManager.GetNewHost(form, createAllOwnerDrawControls, getControlDesignerInfo, AdminMode, this);

            AddNewHost(hc);

            RuntimeDesignerHandleState.SaveState(GetFileName(), RuntimeHostSurface.ComponentsDictionary);

            if (AdminMode)
            {
                FillHiddenControlsPane(RuntimeHostSurface.ComponentsDictionary);

                RuntimeHostSurface.ControlsDeleted += runtimeHostSurface_ControlsHidden;
            }
        }