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 LibraryDelegateCommands are now extendable and provide Async support. A new implementation of theINotifyPropertyChanged interface, the BindabaleBase class, was added.
         Prism.Mvvm是一个跨平台的类库,它封装了Prism对MVVM模式的支持。类库中包含ViewModelLocationProvider。视图和视图模型使用了ViewModelLocationProvider中的一个基于转换的方法进行连接,这在 实现MVVM模式 中有介绍。 视图模型可以使用依赖注入容器构造。视图模型定位器的可扩展性会在 扩展Prism介绍。DelegateCommands 现在可以支持异步。还添加一个全新 INotifyPropertyChanged 接口和 BindabaleBase 类。
  • 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.
         PopupWindowAction 类被添加在Prism.Interactivity 程序集中。用来响应打开一个自定义窗口的交互操作。更多信息可看 进击的MVVM.
  • The EventAggregator classes have been moved to the Prism.PubSubEvents portable class library.
          EventAggregator 类转到Prism.PubSubEvents 这个跨平台的类库中了。
  • 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.
         NavigationParameters 类可以在导航期间传递一组object类型的参数。你将在Region 或RegionManager 实例中的方法RequestNavigate 的一个重载中使用到。

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 PubSubEventsEventAggregator and related classes.
        Microsoft.Practices.Prism.PubSubEvents 跨平台类库包含PubSubEventsEventAggregator 和一些相关的类。
  • The Microsoft.Practices.Prism.Mvvm portable class library contains ViewModelLocationProviderBindableBaseErrorsContainer, PropertySupport, CompositeCommand, DelegateCommand, DelegateCommandBase, and WeakEventHandlerManager.
        Microsoft.Practices.Prism.Mvvm 跨平台类库包含s ViewModelLocationProviderBindableBaseErrorsContainer, PropertySupport, CompositeCommand, DelegateCommand, DelegateCommandBase, and WeakEventHandlerManager
  • The Microsoft.Practices.Prism.Mvvm.Desktop assembly contains the WPF ViewModelLocator attach property.
        Microsoft.Practices.Prism.Mvvm.Desktop 程序集包含ViewModelLocator 附加属性。
  • The EventAggregator classes are marked obsolete in the Prism assembly.
        EventAggregator 类被标记为过时。
  • 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.
        Silverlight和phone的版本被移除了。如果你想用,还得看Prism4.1。
  • Prism and Prism.Mvvm are independent of each other but share IActiveAware. Therefore IActiveAware has been moved to Prism.SharedInterfaces.
        Prism和Prism.Mvvm 是彼此独立的单共享了IActiveAware ,因此IActiveAware 已经移到Prism.SharedInterfaces.

In version 5.0 of Prism, Pub Sub Eventing functionality was moved into a separate assembly (Prism.PubSubEvents). DelegateCommandCompositeCommand, 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)。     DelegateCommandCompositeCommand, 和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.
        你可以可选择的使用Prism的功能。如果你想要区域和模块化,你可以使用核心Prism程序集。如果你想用ViewModel 和命令支持,你可以使用Prism.Mvvm. 如果你只想使用 发布/订阅事件,使用Prism.PubSubEvents。每个程序集都更小更易理解了。
  • 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.
        你可以在跨平台类库中构建你的Viewodel ,其中你还可以使用Prism.Mvvm 和 Prism.PubSubEvents ,以为这俩也是跨平台的库。把你的ViewModel 代码放到PCL(跨平台类库)里,你的ViewModel 就需要依赖那种平台无关的程序集,以便你的代码可以针对多种平台。
  • 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.
        在 Prism.Mvvm中的BindableBase 类替代NotifcationObject 。NotificationObject 和 NotificationObject 类在Prism程序集中被标记为过时。
  • 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.
        当你的类继承自BindableBase 类,可用使用SetProperty 方法更新属性的支持字段并引起相应属性改变事件。一个新的OnPropertyChanged 方法可用以lambda表达式作为参数。
  • 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.
        使用在 Microsoft.Practices.PubSubEvents 跨平台类库的PubSubEvents 类替代CompositePresentationEvents。在事件解决方案文件夹中的类已经被标记为过时。
  • The UriQuery class was renamed to NavigationParameters, it keeps the same functionality as before, and adds support for passing object parameters.
        UriQuery 类重命名为NavigationParameters,它保存了一些之前相同的功能,添加了object类型参数的传递。
  • 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.
        DelegateCommand 包含异步处理支持,并且被移动到Prism.Mvvm 跨平台类库。DelegateCommand 和CompositeCommand 都使用了theWeakEventHandlerManager 来触发CanExecuteChanged 事件。WeakEventHandlerManager 必须被第一个构造在UI线程上以便可以获得UI线程的SynchronizationContext 属性引用。
  • EventAggregator now must be constructed on the UI thread to properly acquire a reference to the UI thread’s SynchronizationContext.
        EventAggregator 现在必须构建在UI线程,这样才能获取SynchronizationContext 属性引用。
  • The WeakEventHandlerManager is now public.
        WeakEventHandlerManager 现在变为public。
  • The Execute and CanExecute methods on DelegateCommand are now marked as virtual.
        在DelegateCommand 的 Execute 和 CanExecute 方法现在被标记为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.PubSubEvents 帮助你发送松耦合的消息,是使用一个跨平台的类。
  • 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.Mvvm 帮你使用MVVM模式。是使用一个跨平台的类和一些平台相关的程序集。
  • 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.
        Microsoft.Practices.Prism.SharedInterfaces 添加了 Prism 和Prism.Mvvm 共享的IActiveAware 接口。因此IActiveAware 接口已经从Prism 核心库中移除了。

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 快速入门.此示例展示了一个非常简单的使用ViewModel 定位器的MVVM应用程序。并指示了一个嵌套ViewModels 。更多信息,请看MVVM快速入门。
  • MVVM QuickStart. This QuickStart was removed for this version.
        MVVM  快速入门 .此示例已经从此版本移除。
  • MVVM Reference Implementation. This reference implementation was removed for this version.
        MVVM 参考实现. 此示例已经从此版本移除。
  • 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.
        视图切换导航快速入门 . 此示例现在支持WPF。它描述了怎样使用Prsim区域导航API。更多信息,请看 视图切换导航快速入门.
  • 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.
        基于状态导航快速入门 . 此示例现在支持WPF。它站了一个使用视图状态管理者的方法去定义视图状态并允许切换。更多信息,请看 基于状态导航快速入门
  • 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.
        组合式UI快速入门 .  此示例现在支持WPF。它替换了在Prism2.0中的视图注入快速入门和视图发现快速入门。当前版本下,视图发现和视图注入在同一个例子程序中体现。更多信息,请看 组合式UI快速入门.
  • 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.
        交互快速入门. 这是个新的快速入门,展示了怎样暴露一个视图上的交互请求到视图模型上。当弹窗需要一个自定义视图模型时,此交互可以是一个弹窗,确认窗,自定义弹窗,或是一个更复杂的情况。它也展示了Prism的InvokeCommandAction 动作,可以从触发器传递一个作为命令参数的EventArgs 。更多信息,请看 交互快速入门

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程序集的引用。包里包括:

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(英汉对照版)的更多相关文章

  1. 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 ...

  2. 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 下载并安装 ...

  3. 下载并安装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 ...

  4. 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 ...

  5. 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- ...

  6. 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 ...

  7. 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 ...

  8. Prism5.0新内容(纯汉语版)

    Prism 5.0 包含很多新东西,新的快速入门示例,新的范例,更新的文档,Prism类库代码的改变.用来解决已有问题,回应社区所提的需求.(这句话跟 What's New in Prism Libr ...

  9. android6.0、7.0、8.0新特性总结之开发应用时加以考虑的一些主要变更。

    android6.0 参考一:简书Android 6.0 新特性详解 参考二:关于Android6.0以上系统的权限问题 参考三:值得你关注的Android6.0上的重要变化(一) 参考四:值得你关注 ...

随机推荐

  1. ionic学习笔记—创建项目

    环境搭建: 安装node.js  --> npm或cnpm   -->  安装jdk  -->  安装AndroidSDK  -->  安装cordova  -->  安 ...

  2. ansible安装及使用

    一.ansible介绍 1.ansible简介 官方的title是“Ansible is Simple IT Automation”——简单的自动化IT工具. Ansible跟其他IT自动化技术的区别 ...

  3. python 2 和python 3的 区别

    用户交互 input  ps:python2:raw_input python3:input 在 python2里 print不需要加括号也可以打印 子python3里 print 必须加括号才能打印

  4. JavaScript:确认对话框

    <script type="text/javascript"> function Check() { if (window.confirm('您是否参与抽奖?')) { ...

  5. Java:正则表达式

    Java:正则表达式 package com.fsti.icop.util.regexp; import java.util.regex.Matcher; import java.util.regex ...

  6. EasyUI:datagrid数据汇总

    EasyUI:datagrid数据汇总 js代码: var total=0;//全局变量 $(function(){ $('#tablebudgetdata').datagrid({ title:' ...

  7. c# 布局(stackpanel)

    <Grid> <StackPanel> <Button Content="asas"> </Button> <Button C ...

  8. Aware接口

    Aware接口: 例如: BeanNameAware接口是为了让自身Bean能够感知到,获取到自身在Spring容器中的id属性. 同理,其他的Aware接口也是为了能够感知到自身的一些属性. 比如实 ...

  9. 关于ENABLE_BITCODE

    pod 'TSVoiceConverter' 如果,设置了工程target的ENABLE_BITCODE为NO.但是,在真机上运行时,仍然提示类似于如下错误: URGENT: all bitcode ...

  10. nginx官网下载&百度云分享

    官网下载的链接: nginx官网下载地址:http://nginx.org/download/ 百度云分享 链接:https://pan.baidu.com/s/16m6zrFSkYCJtX0rD2Y ...