当前位置: 首页 > news >正文

餐饮招商加盟网站建设费用网站登录界面html

餐饮招商加盟网站建设费用,网站登录界面html,阿里指数网站,wordpress插件和主题区别Prism for WPF初探#xff08;构建简单的模块化开发框架#xff09; 原文:Prism for WPF初探#xff08;构建简单的模块化开发框架#xff09;先简单的介绍一下Prism框架#xff0c;引用微软官方的解释#xff1a; Prism provides guidance to help you more easily desi… Prism for WPF初探构建简单的模块化开发框架 原文:Prism for WPF初探构建简单的模块化开发框架  先简单的介绍一下Prism框架引用微软官方的解释 Prism provides guidance to help you more easily design and build, flexible, and easy-to-maintain client business apps that run on Windows Runtime, Windows Presentation Foundation (WPF) desktop, Silverlight, or Windows Phone 7. These apps may start small and evolve over time. 官方链接https://msdn.microsoft.com/en-us/library/ff648465.aspx可下载到文档和示例代码。   多的介绍就不必了研究这套框架的人基本是做WPF或者Silverlight的人我是新人理解不深还请大神指教。听说Prism是开源的做了才一年的小菜目前框架都用的不熟以后再看源码吧。 Prism要用到IOC容器提供选择的有Unity和MEF这个系列的博文以后我都选用MEF。不懂MEF的建议看看这位大牛的系列博文http://www.cnblogs.com/yunfeifei/p/3922668.html 先说一下思路   1、Prism思想是模块化编程我将主界面拆分为四个模块A、B、C、D。   2、模块之间不能互相引用也就是解耦了。   3、目前就以上两点要考虑到以后对项目进行扩展所以预留一个InfrastructureProject放置模块之间抽象的东西。   完成之后的界面图如下     解决方案总体结构 一、基本结构搭建   1、按照上图结构添加项目注意只有Desktop.MainWindow中保留App.xaml并且输出类型是Windows应用程序其余的Project都要删除App.xaml输出类型为类库。   2、删除Desktop.MainWindow中的默认的MainWindow新建一个Shell窗体根据Prism的思想这个Shell就是主窗体。   3、为所有的Project添加Prism的引用我这里为所有的Project安装了以下四个Prism的Nuget包。        4、在ModuleA中新建类ModuleAModuleBModuleCModuleD继承自IModule接口只有继承这个接口才能被加载进Prism中。    using Prism.Modularity; using Prism.Mef.Modularity; using Prism.Regions; using System.ComponentModel.Composition;namespace ModuleA {[ModuleExport(ModuleA, typeof(ModuleA), InitializationMode InitializationMode.WhenAvailable)]public class ModuleA : IModule{ private readonly IRegionViewRegistry regionViewRegistry;[ImportingConstructor]public ModuleA(IRegionViewRegistry registry){this.regionViewRegistry registry;}public void Initialize(){regionViewRegistry.RegisterViewWithRegion(RegionA,typeof(View.GridA));}} } 注意最后一行代码 regionViewRegistry.RegisterViewWithRegion(RegionA,typeof(View.GridA));RegionA就是主界面吧Shell中为ModuleA模块预留的位置可以理解为占位符View.GridA就是我们为ModuleA写的的界面。BCD模块同理。   5、添加一个BootStrapper类这个类要继承自MefBootstrapper。   Prism提供四种配置模块加载的方式看官方文档这里我提供第一种和第二种方式       using Prism.Mef; using Prism.Modularity; using Prism; using System; using System.Collections.Generic; using System.ComponentModel.Composition.Hosting; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using ModuleA;namespace Desktop.MainWindow {public class BootStrapper:MefBootstrapper{protected override DependencyObject CreateShell(){return this.Container.GetExportedValueShell();}protected override void InitializeShell(){base.InitializeShell();Application.Current.MainWindow (Shell)this.Shell;Application.Current.MainWindow.Show();}protected override void ConfigureAggregateCatalog(){base.ConfigureAggregateCatalog();this.AggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof(BootStrapper).Assembly));//this.AggregateCatalog.Catalogs.Add(new AssemblyCatalog(this.GetType().Assembly));//第一种加载方式this.AggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof(ModuleA.ModuleA).Assembly));this.AggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof(ModuleB.ModuleB).Assembly));this.AggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof(ModuleC.ModuleC).Assembly));this.AggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof(ModuleD.ModuleD).Assembly));}protected override IModuleCatalog CreateModuleCatalog(){// When using MEF, the existing Prism ModuleCatalog is still the place to configure modules via configuration files.return new ConfigurationModuleCatalog();}//Prism提供四种加载模块的方式以下是第二种从xaml文件中加载注意文件要生成Resource并且始终复制到输出目录//protected override IModuleCatalog CreateModuleCatalog()//{// this.ModuleCatalog new ModuleCatalog();// var xamlCatalog Prism.Modularity.ModuleCatalog.CreateFromXaml(new Uri(ModuleCatalogs.xaml, UriKind.Relative));// //var xamlCatalog Prism.Modularity.ModuleCatalog.CreateFromXaml(new Uri(ModuleCatalogs.xaml, UriKind.Relative));// foreach (var item in xamlCatalog.Modules)// {// ModuleCatalog.AddModule(item);// }// return xamlCatalog;//}} }   6、在App.xaml中把启动项设置为BootStrapper应该都会吧不会的看源码哦。至此一个简单的基于MEF的Prism框架就搭建好了。链接提供源码。   源码在这呢   posted on 2018-06-01 10:45 NET未来之路 阅读(...) 评论(...) 编辑 收藏 转载于:https://www.cnblogs.com/lonelyxmas/p/9120595.html
http://wiki.neutronadmin.com/news/77858/

相关文章:

  • 网站生成自助网站建设大作业选题
  • 济南营销型网站网站建设部署与发布试题
  • 简述网站建设评估的指标有哪些wordpress视频网站采集器
  • 中山建设厅网站首页个人做企业网站
  • 做网站怎么宣传昌平网站制作
  • 信用南京网站wordpress显示大写
  • 网站源代码程序织梦网站主页底
  • 网站开发开票内容写什么网站设计风格大全
  • 电脑商业网站怎的做简单的品牌创意设计公司
  • 北大荒建设集团有限公司网站网站中文名称注册
  • 网站建设技巧饣金手指排名27威县网站建设
  • 室内设计学校排名榜国内广州做网站seo
  • 网站百度收录是什么意思肥城做网站tahmwlkj
  • 深圳网站建设罗湖国内老牌的广州网站建设
  • 淘宝客高佣金网站建设怎样做外国石雕产品网站
  • 无极门户网站手机网站建设原则
  • 网站突然掉排名了中国前十强集团
  • 三网合一网站报价手机百度云网页版登录
  • 珠海电脑自己建网站免费网站推广群发软件
  • 网站开发国内外研究状况摄影网站备案
  • 免费推广网站2022张家界做旅游网站
  • 建站seo推广手机页面网站开发例子
  • 值得相信的西安网站开发网站代运营合同模板
  • 网站页面高度深圳网站建设哪家公司好
  • 建设企业网站可信度网站开发写好了怎么发布
  • 外贸营销网站制作腾讯云 安装 wordpress
  • 一家专做中式设计的网站中国企业500强营业收入
  • 阿里云网站建设流程网上效果代码网站可以下载吗
  • 哪个网站可以做ppt网站的规划与建设课程设计
  • 网站设计与平面设计区别广州网站设计 信科网络