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上的重要变化(一) 参考四:值得你关注 ...
随机推荐
- Python高级教程-切片
Python中的切片 取一个list或tuple的部分元素是非常常见的操作.比如,一个list如下: >>> L = ['A','B','C','D'] 对经常取指定索引范围的操作, ...
- ajax请求真实服务器数据示例
// http://study.163.com/webDev/couresByCategory.htm // http://study.163.com/webDev/couresByCategory. ...
- 海量数据处理之Bloom Filter详解
前言 : 即可能误判 不会漏判 一.什么是Bloom Filter Bloom Filter是一种空间效率很高的随机数据结构,它的原理是,当一个元素被加入集合时,通过K个Hash函 ...
- Cpython支持的进程与线程(Day33)
一.multiprocessing模块介绍 python中的多线程无法利用CPU资源,在python中大部分情况使用多进程.python中提供了非常好的多进程包multiprocessing. mul ...
- Tornado的基本知识
Tornado是FriendReed使用的可扩展的非阻塞式的web服务器及其相关工具的开源版本. 这个框架看起来有些像web.py或者Google的webapp,不过为了能有效利用非阻塞服务器环境,这 ...
- module.exports和exports得区别
对module.exports和exports的一些理解 可能是有史以来最简单通俗易懂的有关Module.exports和exports区别的文章了. exports = module.exports ...
- https过程
HTTPS在传输数据之前需要客户端(浏览器)与服务端(网站)之间进行一次握手,在握手过程中将确立双方加密传输数据的密码信息.TLS/SSL协议不仅仅是一套加密传输的协议,更是一件经过艺术家精心设计的艺 ...
- SpringBoot之Servlet、Filter、Listener配置
在SpringBoot中是不需要配置web.xml的,那么原来在web.xml中配置的Servlet.Filter.Listener现在怎么弄呢? SpringBoot提供了三种Bean Filter ...
- MySQL-5.7 DELETE语句详解
1.语法 (1)单表 DELETE [LOW_PRIORITY] [QUICK] [IGNORE] FROM tbl_name [PARTITION (partition_name [, partit ...
- Nginx 限制php解析、限制浏览器访问
限制php解析 1.有时候会根据目录来限制php解析: location ~ .*(diy|template|attachments|forumdata|attachment|image)/.*\.p ...