zoukankan      html  css  js  c++  java
  • [转]基于MefBootstrapper的Bootstrapper

    public class Bootstrapper : MefBootstrapper
        {
            ModuleCatalog moduleCatalog;

            protected override void InitializeShell()
            {
                base.InitializeShell();

                Application.Current.RootVisual = (UIElement)Shell;
            }

            protected override DependencyObject CreateShell()
            {
                return Container.GetExportedValue<Shell>();
            }

            protected override void ConfigureAggregateCatalog()
            {
                base.ConfigureAggregateCatalog();
                AggregateCatalog.Catalogs.Add(new AssemblyCatalog(this.GetType().Assembly));
            }

            protected override void ConfigureContainer()
            {
                base.ConfigureContainer();
                this.Container.ComposeExportedValue<ModuleCatalog>(this.moduleCatalog);
            }

            /// <summary>
            /// 以文件配置加载模块信息
            /// </summary>
            /// <returns></returns>
            protected override IModuleCatalog CreateModuleCatalog()
            {
                //
                moduleCatalog = Microsoft.Practices.Prism.Modularity.ModuleCatalog.CreateFromXaml(new Uri("/KJ;component/ModulesCatalog.xaml", UriKind.Relative));
                return moduleCatalog;
            }

            /// <summary>
            /// 以代码来加载模块信息
            /// </summary>
            /// <returns></returns>
            //protected override IModuleCatalog CreateModuleCatalog()
            //{
            //    ModuleCatalog moduleCatalog = new ModuleCatalog();

            //    //moduleCatalog.AddModule
            //    //(
            //    //    new ModuleInfo
            //    //    {
            //    //        InitializationMode = InitializationMode.OnDemand,
            //    //        Ref = "ModuleA.xap",
            //    //        ModuleName = "ModuleARegion",
            //    //        ModuleType = "ModuleA.ModuleARegion, ModuleA"
            //    //    }
            //    //);

            //    //moduleCatalog.AddModule
            //    //(
            //    //    new ModuleInfo
            //    //    {
            //    //        Ref = "ModuleLogin.xap",
            //    //        ModuleName = "ModuleLogin",
            //    //        ModuleType = "ModuleLogin.ModuleLogin, ModuleLogin"
            //    //    }
            //    //);

            //    moduleCatalog.AddModule
            //    (
            //        new ModuleInfo
            //        {
            //           // InitializationMode = InitializationMode.OnDemand,
            //            Ref = "ModuleMain.xap",
            //            ModuleName = "ModuleMain",
            //            ModuleType = "ModuleMain.ModuleMain, ModuleMain"
            //        }
            //    );

            //    return moduleCatalog;
            //}

  • 相关阅读:
    解决php网页运行超时问题:Maximum execution time of 30 seconds exceeded
    C#操作Xml:XSLT语法 在.net中使用XSLT转换xml文档示例
    C#操作Xml:XPath语法 在C#中使用XPath示例
    C#操作Xml:XmlSerializer 对象的Xml序列化和反序列化
    C#操作Xml:如何定义Xsd文件
    C#操作Xml:linq to xml操作XML
    C#操作Xml:使用XmlWriter写Xml
    C#操作Xml:使用XmlReader读Xml
    C#操作Xml:通过XmlDocument读写Xml文档
    XML的序列化和反序列化 详细介绍
  • 原文地址:https://www.cnblogs.com/luohengstudy/p/3545874.html
Copyright © 2011-2022 走看看