コード例 #1
0
 void HostControl_MouseEnter(object sender, EventArgs e)
 {
     VOB.InterfaceVOB iv = (VOB.InterfaceVOB)_hostSurface.GetService(typeof(VOB.InterfaceVOB));
     if (iv != null)
     {
         iv.SendNotice(enumVobNotice.HideToolbox, true);
     }
 }
コード例 #2
0
        public ILimnorDesignPane CreateDesigner(ClassData classData)
        {
            ILimnorDesignPane limnorXmlPane = null;

            try
            {
                DesignUtil.LogIdeProfile("Create designer loader");
                LimnorXmlDesignerLoader2 designerLoader = new LimnorXmlDesignerLoader2(classData);
                DesignUtil.LogIdeProfile("Create designer surface");
                HostSurface designSurface = (HostSurface)this.CreateDesignSurface(this.ServiceContainer);

                IDesignerHost dh = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost));

                dh.AddService(typeof(INameCreationService), new NameCreationService());

                IServiceContainer serviceContainer = dh.GetService(typeof(ServiceContainer)) as IServiceContainer;
                DesignUtil.LogIdeProfile("Load designer surface");
                designSurface.Loader = designerLoader;
                designSurface.BeginLoad(designerLoader);
                if (VPLUtil.Shutingdown)
                {
                    return(null);
                }
                DesignUtil.LogIdeProfile("Add designer services");
                XMenuCommandService menuServices = new XMenuCommandService(serviceContainer);
                dh.AddService(typeof(IMenuCommandService), menuServices);
                menuServices.AddVerb(new DesignerVerb("Cut", null, StandardCommands.Cut));
                menuServices.AddVerb(new DesignerVerb("Copy", null, StandardCommands.Copy));
                menuServices.AddVerb(new DesignerVerb("Paste", null, StandardCommands.Paste));
                menuServices.AddVerb(new DesignerVerb("Delete", null, StandardCommands.Delete));
                menuServices.AddVerb(new DesignerVerb("Undo", null, StandardCommands.Undo));
                menuServices.AddVerb(new DesignerVerb("Redo", null, StandardCommands.Redo));

                if (dh.GetService(typeof(IDesignerSerializationService)) == null)
                {
                    dh.AddService(typeof(IDesignerSerializationService), new DesignerSerializationService(serviceContainer));
                }

                if (dh.GetService(typeof(ComponentSerializationService)) == null)
                {
                    //DesignerSerializationService uses CodeDomComponentSerializationService
                    CodeDomComponentSerializationService codeDomComponentSerializationService = new CodeDomComponentSerializationService(serviceContainer);
                    dh.AddService(typeof(ComponentSerializationService), codeDomComponentSerializationService);
                }
                VOB.UndoEngineImpl undoEngine = new VOB.UndoEngineImpl(serviceContainer);
                undoEngine.Enabled = false;
                dh.AddService(typeof(UndoEngine), undoEngine);

                designerLoader.AddComponentChangeEventHandler();
                DesignUtil.LogIdeProfile("Create designer pane");
                limnorXmlPane = new LimnorXmlPane2(designSurface, designerLoader);
                if (designerLoader.IsSetup)
                {
                }
                else
                {
                    DesignUtil.LogIdeProfile("Apply config");
                    if (limnorXmlPane.Loader.ObjectMap != null)
                    {
                        limnorXmlPane.BeginApplyConfig();
                    }
                }
                DesignUtil.LogIdeProfile("Initialize designer surface");
                designSurface.Initialize();
                ILimnorToolbox toolbox = (ILimnorToolbox)GetService(typeof(IToolboxService));
                toolbox.Host             = dh;
                this.ActiveDesignSurface = designSurface;
                //
            }
            catch (Exception ex)
            {
                MathNode.Log(TraceLogClass.MainForm, ex);
                // Just rethrow for now
                throw;
            }
            DesignUtil.LogIdeProfile("Finish creating designer");
            return(limnorXmlPane);
        }