Prism5.0新内容 What's New in Prism Library 5.0 for WPF(英汉对照版)
Prism 5.0 includes guidance in several new areas, resulting in new code in the Prism Library for WPF, new and updated QuickStarts, and updated documentation. Parts of the Prism Library changed between Prism 4.1 and Prism 5.0 to support the new guidance, fix existing issues, and respond to community requests.
Prism 5.0 包含很多新东西,新的快速入门示例,新的范例,更新的文档,Prism类库代码的改变。用来解决已有问题,回应社区所提的需求。(这句话跟 What's New in Prism Library 4.0中的第一句话一模一样,就不能来的新鲜的吗?)
Note: For Silverlight applications use Prism 4.1.
注意:在Silverlight中还得用Prism 4.1.
New Guidance 新指南
Prism 5.0 contains several areas of new guidance as follows:
Prism5.0包含以下新指南:
- Prism.Mvvm is a portable class library that encapsulates Prism’s MVVM support. This library includes ViewModelLocationProvider. Views and view models can be wired up together using the new ViewModelLocationProvider’s convention-based approach as explained in Implementing the MVVM Pattern. View model construction can be accomplished using a dependency injection container. The ViewModel Locator’s extensibility points are discussed in Extending the Prism Library. DelegateCommands are now extendable and provide Async support. A new implementation of theINotifyPropertyChanged interface, the BindabaleBase class, was added.
- The PopupWindowAction class was added to the Prism.Interactivity assembly to open a custom window in response to an interaction request being raised.
The InvokeCommandAction action provided by Prism now passes trigger parameters to the associated command. For more information see Advanced MVVM Scenarios.
- The EventAggregator classes have been moved to the Prism.PubSubEvents portable class library.
- The NavigationParameters class can now be used to pass object parameters during navigation, using the overloads of the RequestNavigate method of a Region or RegionManager instance.
Changes in the Prism Library Prism库的改变
Prism Library 5.0 includes changes related to new functionality, code organization, and APIs.
Prism5.0库的改变包括增加了新功能,代码组织方式,和APIs.
Code Organization 代码组织
The following organizational changes were made to the library:
下面是库中代码的一些变化:
- The Microsoft.Practices.Prism.PubSubEvents portable class library contains PubSubEvents, EventAggregator and related classes.
- The Microsoft.Practices.Prism.Mvvm portable class library contains ViewModelLocationProvider, BindableBase, ErrorsContainer, PropertySupport, CompositeCommand, DelegateCommand, DelegateCommandBase, and WeakEventHandlerManager.
- The Microsoft.Practices.Prism.Mvvm.Desktop assembly contains the WPF ViewModelLocator attach property.
- The EventAggregator classes are marked obsolete in the Prism assembly.
- The Silverlight and phone versions of the Prism Library were taken out. If you need these libraries download the Prism 4.1 assemblies from NuGet.
- Prism and Prism.Mvvm are independent of each other but share IActiveAware. Therefore IActiveAware has been moved to Prism.SharedInterfaces.
In version 5.0 of Prism, Pub Sub Eventing functionality was moved into a separate assembly (Prism.PubSubEvents). DelegateCommand, CompositeCommand, and ViewModel support were moved into another assembly (Prism.Mvvm). There are many advantages to separating PubSubEvents and Mvvm from the core Prism assembly.
在Prism5.0这个版本中,发布/订阅事件功能移到了一个单独的程序集(Prism.PubSubEvents)。 DelegateCommand, CompositeCommand, 和ViewModel 的支持移动到(Prism.Mvvm)。这样的分离很有好处。
- You can select only the functionality that you need. If you want Regions and Modularity, you use the core Prism assembly. If you want only ViewModel and commanding support, you use Prism.Mvvm. If you only want Pub Sub Eventing, you use Prism.PubSubEvents. Each assembly is smaller and easier to understand.
- You can now build your Viewodel code in a portable class library that leverages Prism.Mvvm and/or Prism.PubSubEvents since both are PCLs. By putting your ViewModel code in a PCL, your ViewModel code is constrained to using dependent libraries that are platform agnostic and thus can target multiple platforms.
- Updates to these smaller libraries can be made more easily and quickly.
API Changes API的改变
The Prism Library API changed in several key areas. The bootstrapper was heavily modified and reusable code was added to support the new areas of guidance provided in Prism.
Prism类库API有一些关键领域的改变。bootstrapper 有重大变化,一些重用代码被添加以支持Prism新功能。
MVVM and Event Aggregator Changes. MVVM和事件聚合的改变。
Moving ViewModel and EventAggregator to a PCL causes several changes to the Prism Library. These changes include the following:
移动ViewModel 和EventAggregator 到PCL(跨平台类库)引起了一些改变。改变如下:
- The BindableBase class in Prism.Mvvm should be used instead of NotifcationObject. The NotificationObject and NotificationObject classes are marked obsolete in the Prism assembly.
- When inheriting from the BindableBase class, use the SetProperty method to update the property's backing field and raise the corresponding property change event. A newOnPropertyChanged method that takes a lambda expression as a parameter has been added.
- Use the PubSubEvents class in the Microsoft.Practices.PubSubEvents portable class library instead of CompositePresentationEvents. The classes from the Events solution folder in the Prism assembly are marked obsolete.
- The UriQuery class was renamed to NavigationParameters, it keeps the same functionality as before, and adds support for passing object parameters.
- DelegateCommand includes support for async handlers and has been moved to the Prism.Mvvm portable class library. DelegateCommand and CompositeCommand both use theWeakEventHandlerManager to raise the CanExecuteChanged event. The WeakEventHandlerManager must be first constructed on the UI thread to properly acquire a reference to the UI thread’s SynchronizationContext.
- EventAggregator now must be constructed on the UI thread to properly acquire a reference to the UI thread’s SynchronizationContext.
- The WeakEventHandlerManager is now public.
- The Execute and CanExecute methods on DelegateCommand are now marked as virtual.
Additions to the Prism Library Core API Prism中被添加的核心API
The following namespaces were added to the Prism Library to support the new areas of guidance added in Prism 5.0:
一些命名空间是新被添加的,为了支持新功能:
- Microsoft.Practices.Prism.PubSubEvents was added to help you send loosely coupled message using a portable class library.
- Microsoft.Practices.Prism.Mvvm was added to assist you in implementing MVVM using a portable class library and several platform specific libraries.
- Microsoft.Practices.Prism.SharedInterfaces has been added to share the IActiveAware interface between Prism and Prism.Mvvm assemblies, therefore the IActiveAware interface has been moved to this assembly. It is also intended for future use.
CodePlex Issues Resolved CodePlex上问题的解决
- 8532: InteractionRequestTrigger can cause memory leaks with some implementations. InteractionRequestTrigger 可以引起一些导致内存泄露的实现。
- 9153: 'Notification' really should be an interface. 'Notification'应该是个接口
- 9438: Navigation to an existing view. 导航到一个存在的视图。
- 5495: Event to Command. 命令事件
- 8101: DelegateCommand is not extendable. DelegateCommand 不可扩展
- 5623: Make WeakEventHandlerManager public. 让WeakEventHandlerManager 公开。
- 9906: A bug when using XAML module catalog in WPF. 当使用XAML模块目录的一个bug。
- 7215: Issue with ModuleCatalog.CreateFromXaml for WPF application with MEF Bootstrapper. 使用 MEF Bootstrapper中ModuleCatalog.CreateFromXaml的问题。
- 8703: RegionManager::IsInDesignMode. RegionManager::IsInDesignMode.
- 4349: Default Region Behavior Order Problem. 默认的区域行为顺序问题。
- 3552: Region manager in V2 fails to recognize non-WPF applications.区域管理器不识别费WPF程序。
Example Code Changes 示例代码的改变
Prism 5.0 contains eleven separate code samples that demonstrate portions of the provided guidance. Several samples from Prism 4.1 were removed or replaced, and new samples added.
Prism5.0包含了11个单独的代码示例,展示不同的功能。一些Prism4.1的示例被替换或是移除,新的示例被添加。
The following samples were added for Prism 5.0:
被添加到Prism5.0的新示例:
- Basic MVVM QuickStart. This QuickStart shows a very simple MVVM application that uses the ViewModel Locator and show a parent and child ViewModels. For more information, see the MVVM QuickStart.
- MVVM QuickStart. This QuickStart was removed for this version.
- MVVM Reference Implementation. This reference implementation was removed for this version.
- View-Switching Navigation QuickStart. This QuickStart now supports WPF. It demonstrates how to use the Prism region navigation API. For more information, see View-Switching Navigation QuickStart.
- State-Based Navigation QuickStart. This QuickStart now supports WPF. It shows an approach that uses the Visual State Manager to define the views (states) and the allowed transitions. For more information, see State-Based Navigation QuickStart.
- UI Composition QuickStart. This QuickStart now supports WPF. It replaced the View Injection QuickStart and the View Discovery QuickStart from Prism 2.0. In the current versions, both concepts are shown in one example application. For more information, see UI Composition QuickStart.
- Interactivity QuickStart. This new QuickStart demonstrates how to exposes an interaction request to the view through the view model. The interactions can be a popup, confirmation, custom popup, and a more complex case where the popup needs a custom view model. It also shows Prism’s InvokeCommandAction action that passes the EventArgs from the trigger, as a command parameter. For more infromation, see Interactivity QuickStart.
NuGet Packages Now Available 目前可用的NuGet包
In your application, you can now use NuGet to add references to the Prism assemblies. These packages include:
在你的应用程序,你可以使用NuGet添加Prism程序集的引用。包里包括:
- Prism
- Prism.Composition
- Prism.Interactivity
- Prism.Mvvm
- Prism.PubSubEvents
- Prism.UnityExtensions
- Prism.MEFExtensions
| Note:注意 |
|---|
| The Prism NuGet package will download the Prism.Composition, Prism.Interactivity, Prism.Mvvm, and Prism.PubSubEvents packages. You only need to add references to the Prism.Interactivity, Prism.Mvvm, and Prism.PubSubEvents if you need finer granularity. Prism NuGet包将下载 Prism.Composition, Prism.Interactivity, Prism.Mvvm, and Prism.PubSubEvents包。你也可以单独添加Prism.Interactivity, Prism.Mvvm, 和Prism.PubSubEvents 引用。 |
More Information 更多信息
For more information about how to upgrade a solution from version 4.1 to version 5.0 of the Prism Library, see Upgrading from Prism Library 4.1.
如果你想了解从Prism4.1升级到Prism5.0。请看从Prism 4.1升级.
Prism5.0新内容 What's New in Prism Library 5.0 for WPF(英汉对照版)的更多相关文章
- 2: 使用Prism初始化程序 Initializing Applications Using the Prism Library 5.0 for WPF(英汉对照版)
This topic addresses what needs to happen to get a Prism for WPF application up and running. A Prism ...
- Prism5.0开发人员指南内容 Contents of the Developer's Guide to Prism Library 5.0 for WPF(英汉对照版)
The Prism for WPF guide contains the following topics: Prism指南包含以下内容: Download and Setup Prism 下载并安装 ...
- 下载并安装Prism5.0库 Download and Setup Prism Library 5.0 for WPF(英汉对照版)
Learn what’s included in Prism 5.0 including the documentation, WPF code samples, and libraries. Add ...
- Prism开发人员指南5-WPF开发 Developer's Guide to Microsoft Prism Library 5.0 for WPF (英汉对照版)
April 2014 2014四月 Prism provides guidance in the form of samples and documentation that help you e ...
- 1: 介绍Prism5.0 Introduction to the Prism Library 5.0 for WPF(英汉对照版)
Prism provides guidance designed to help you more easily design and build rich, flexible, and easy- ...
- 4: 模块化应用程序开发 Modular Application Development Using Prism Library 5.0 for WPF (英汉对照版)
A modular application is an application that is divided into a set of loosely coupled functional uni ...
- 3: 组件间的依赖管理 Managing Dependencies Between Components Using the Prism Library 5.0 for WPF(英汉对照版)
Applications based on the Prism Library are composite applications that potentially consist of many ...
- Prism5.0新内容(纯汉语版)
Prism 5.0 包含很多新东西,新的快速入门示例,新的范例,更新的文档,Prism类库代码的改变.用来解决已有问题,回应社区所提的需求.(这句话跟 What's New in Prism Libr ...
- android6.0、7.0、8.0新特性总结之开发应用时加以考虑的一些主要变更。
android6.0 参考一:简书Android 6.0 新特性详解 参考二:关于Android6.0以上系统的权限问题 参考三:值得你关注的Android6.0上的重要变化(一) 参考四:值得你关注 ...
随机推荐
- Android图片加载框架Picasso最全使用教程5
在之前的四篇博客中,我们学习了所有的关于Picasso的主要方法,我们也对这个Picasso有了一个很深的认识,下面就主要对Picasso自身进行分析,这样的话,会让我们更了解Picasso的核心方法 ...
- java 小数转百分比
NumberFormat percent = NumberFormat.getPercentInstance(); percent.setMaximumFractionDigits(2); //保留多 ...
- Oracle事务和锁机制
事务 1. 说明 一组SQL,一个逻辑工作单位,执行时整体修改或者整体回退. 2.事务相关概念 1)事务的提交和回滚:COMMIT/ROLLBACK 2)事务的开始和结束 开始事务:连接到数据库,执行 ...
- OpenOCD SWD调试stm32f0
参考:http://www.stmcu.org.cn/module/forum/thread-610998-1-2.html
- Linux网络接口配置文件ifcfg-eth0解析
本文转自:http://blog.csdn.net/jmyue/article/details/17288467 在Windows上配置网络比较容易,有图形化界面可操作.在Linux中往往是通过命令修 ...
- case的嵌套使用
case分支语句的格式如下: case $变量名 in 模式1) 命令序列1 ;; 模式2) 命令序列2 ;; *) 默认执行的命令序列 ;; esac case语句结构特点如下: 1. ...
- 网络:W5500用浏览器配置设备
1.背景 嵌入式端使用网络通信后,可以在PC端进行设备配置.方法有二:1)上位机配置:2)浏览器配置. 上位机配置可以把设置和测量作为一体,功能可以很强大,体验较好. 浏览器配置就是在电路板上搭载一个 ...
- Python学习笔记之Python的enumerate函数
Python 的 enumerate() 函数就像是一个神秘的黑箱,你无法简单地用一句话来概括这个函数的作用与用法. enumerate() 函数属于非常有用的高级用法,而对于这一点,很多初学者甚至中 ...
- 介绍Web项目中用到的几款JQuery消息提示插件
第一款 noty 官方网站:https://github.com/needim/noty 第二款 artDialog artDialog是一个精巧的web对话框组件,压缩后只有十多KB,并且不依赖其他 ...
- tinyxml优化之一
原文链接:http://www.cnblogs.com/zouzf/p/4154569.html 最近在搞XML解析优化,公司引擎用了tinyxml1和tinyxml2两个XML库,后者的效率比前者高 ...