下载并安装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. Additionally find out where to get the library and sample source code and the library NuGet packages.
Prism5.0中包含了文档,WPF代码示例,程序集。本篇告诉你从哪里获取程序集和代码示例,还有NuGet包的内容。
For a list of the new features, assets, and API changes, see What's New in Prism 5.0.
对于新功能,资产,和API的更改信息,请看Prism5.0新内容.
Documentation 文档
Prism includes the following documentation:
Prism包含以下文档:
- Developer's Guide to Microsoft Prism 5.0 on MSDN. 在MSDN上的Prism5.0开发者指南.
- Prism Reference Documentation on MSDN. Prism在MSDN上的参考文档.
- Developer's Guide to Microsoft Prism 5.0 in .pdf format. PDF版的Prism5.0开发者指南.
- Prism Reference Documentation in chm format. chm格式的Prism参考文档.
NuGet Packages NuGet包
- Prism: Downloads NuGet dependency packages—Prism.Composition, Prism.Interactivity, Prism.Mvvm, and Prism.PubSubEvents NuGet Packages.
- Prism.Composition: Modularity, UI Composition, Bootstrapping, Interactivity, IActiveAware, Navigation, and deprecated NotificationObject and PropertySupport.
- Prism.Interactivity: Interactivity.
- Prism.Mvvm: The Portable Class Library for MVVM and the associated platform specific code to support MVVM. Includes Commanding, BindableBase, ErrorsContainer, IView, and ViewModelLocationProvider.
- Prism.PubSubEvents: The Portable Class Library for PubSubEvents.
- Prism.UnityExtensions: Use these extensions to Prism to build Prism applications based on Unity.
- Prism.MefExtensions: Use these extensions to Prism to build Prism applications based on Managed Extensibility Framework (MEF).
The following table shows common Prism namespaces and in which assemblies and NuGet packages they can be found.
下表显示Prism公共命名空间。并限塑令额你从哪个程序集和从哪个NuGet包可以找到它。
Namespace |
Assembly |
NuGet Package |
---|---|---|
Microsoft.Practices.Prism.Logging Microsoft.Practices.Prism.Modularity Microsoft.Practices.Prism.Regions |
Microsoft.Practices.Prism.Composition |
Prism.Composition |
Microsoft.Practices.Prism.Interactivity |
Microsoft.Practices.Prism.Interactivity |
Prism.Interactivity |
Microsoft.Practices.Prism.Commands Microsoft.Practices.Prism.Mvvm Microsoft.Practices.Prism.ViewModel |
Microsoft.Practices.Prism.Mvvm |
Prism.Mvvm |
Microsoft.Practices.Prism.PubSubEvents |
Microsoft.Practices.Prism.PubSubEvents |
Prism.PubSubEvents |
Download and Setup the Prism Source Code 下载并安装Prism源代码
This section describes how to install Prism. It involves the following three steps:
此节描述了怎样安装Prism。分三步:
- Install system requirements. 安装系统需求。
- Download and extract the Prism source code and documentation. 下载并提取Prism库中的源码和文档。
- Compile and run the QuickStarts, Reference Implementation, or Prism Library source code. 编译并运行快速入门,参考实现,或Prism源码。
Step 1: Install System Requirements 第一步:安装系统需求
Prism was designed to run on the Microsoft Windows 8 desktop, Microsoft Windows 7, Windows Vista, or Windows Server 2008 operating system. WPF applications built using this guidance require the .NET Framework 4.5.
在Win8,Win7,Vista,Server2008操作系统上,可运行Prism。用Prism5.0需要.NET Framework 4.5。
Before you can use the Prism Library, the following must be installed:
在你使用Prism库之前,下面两项必须安装:
- Microsoft .NET Framework 4.5 (installed with Visual Studio 2012) or Microsoft .NET Framework 4.51.
- Microsoft Visual Studio 2012 or 2013 Professional, Premium, or Ultimate editions.
Visual Studio 2013 Express Edition can be used to develop Prism applications using the Prism Library. Visual Studio 2013 Express Edition 可以被用作开发Prism应用程序。 |
Optionally, you should consider also installing the following:
可选的,你可以考虑安装这个:
- Microsoft Blend for Visual Studio 2013. A professional design tool for creating compelling user experiences and applications for WPF.
Step 2: Download and Extract the Prism Source Code and Documentation 第二步:下载并提取Prism库源码和文档
You can download the source code for the Prism library, the reference implementation and the QuickStarts from the following link:
Prism库中的一些源码时可以下载到的,下面是参考实现和快速入门示例的下载链接:
To install the Prism assets, right-click the exe file or zip file, and then click Run as administrator. This will extract the source code into the folder of your choice.
右击刚刚下载的exe或zip文件,然后以管理员身份运行。这样做将会提取出Prism库源代码,放到你选择存放的文件夹中。
The Stock Trader Reference Implementation and the QuickStarts can also be downloaded separately. The table below provides links to the source code for each. 股票操盘参考实现和快速入门示例都可以被单独下载,下表分别提供了每个示例下载的连接。 |
Sample 示例 |
Category 类型 |
Description 描述 |
---|---|---|
Stock Trader Reference Implementation 股票操盘参考示例 |
Prism |
The Stock Trader RI application is a reference implementation that illustrates the baseline architecture. Within the application, you will see solutions for common, and recurrent, challenges that developers face when creating composite WPF applications. 股票操盘应用程序是一个描述Prism基本架构的参考实现。在程序中,你将看到一些我们开发组合式WPF应用时面临的公共的,重复遇到的,富有挑战的问题。 The Stock Trader RI illustrates a fictitious, but realistic financial investments scenario. Contoso Financial Investments (CFI) is a fictional financial organization that is modeled after real financial organizations. CFI is building a new composite application to be used by their stock traders. 股票操盘应用程序是一个模拟程序,但是一个现实的金融投资方案。Contoso Financial Investments (CFI) 是个模拟现实金融机构的虚拟机构。CFI想构建你哥给他们股民使用的组合式应用程序。 |
Hello World动手实验室 |
Get Started 入门 |
The Hello World Hands-on Lab demonstrates the end solution for the hands-on lab "Getting Started Using the Prism Library 5.0 for WPF Hands-on Lab." In this lab, you will learn the basic concepts of Prism and apply them to create a Prism Library solution that you can use as the starting point for building a composite WPF. 在Hello World动手实验室示例中,你将看到一些Prism基本概念,你可以用这些概念作为你创建组合式WPF应用的一个起点。 |
Unity模块化入门
MEF模块化入门
|
Modularity 模块化 |
The Modularity QuickStarts demonstrate how to code, discover, and initialize modules using Prism. These QuickStarts represent an application composed of several modules that are discovered and loaded in the different ways supported by the Prism Library using MEF and Unity as the composition containers. 模块化快速入门演示了怎样利用Prism编码,发现,及初始化模块。这些快速入门展示了以不同方式发现并加载模块,利用Unity或是MEF作为组合容器。 |
MVVM快速入门 |
MVVM |
The MVVM QuickStart demonstrates how to build an application that implements the MVVM presentation pattern, showing some of the more common challenges that developers can face, such as wiring a view and view model using the ViewModelLocator, validation, UI interactions, and data templates. MVVM快速入门演示了怎样构建一个实现了MVVM模式的程序,内含使用ViewModelLocator连接视图和视图模型,验证,UI交互,和数据模板。 |
命令快速入门 |
Commanding |
The Commanding QuickStart demonstrates how to build a WPF UI that uses commands provided by the Prism Library to handle UI actions in a decoupled way. 命令快速入门展示了怎样构建一个用Prism命令处理UI动作的WPF界面。利用Prism命令还是一中松耦合的方式。 |
组合式UI快速入门 |
UI Composition |
This QuickStart demonstrates how to build WPF UIs composed of different views that are dynamically loaded into regions and that interact with each other in a decoupled way. It illustrates how to use both the view discovery and view injection approaches for UI composition. 此示例描述了怎样组合不同的视图,视图的加载方式,以松耦合的方式交互。它说明怎样使用视图发现和视图注入方法来组合UI。 |
State-Based Navigation QuickStart 基于状态导航快速入门 |
Navigation |
This QuickStart demonstrates an approach to define the navigation of a simple application. The approach used in this QuickStart uses the WPF Visual State Manager (VSM) to define the different states that the application has and defines animations for both the states and the transitions between states. 此示例描绘了一个定义一个简单应用程序导航的方法。就是使用WPF视图状态管理器(VSM),去定义不同的状态的动画及不同状态间的切换动画。 |
View-Switching Navigation QuickStart 视图切换导航快速入门 |
Navigation |
This QuickStart demonstrates how to use the Prism Region Navigation API. The QuickStart shows multiple navigation scenarios, including navigating to a view in a region, navigating to a view in a region contained in another view (nested navigation), navigation journal support, just-in-time view creation, passing contextual information when navigating to a view, views and view models participating in navigation, and using navigation as part of an application built through modularity and UI composition. 此示例描述怎样使用Prism区域导航API。示例展示多个导航场景,包含导航一个区域内的视图,导航一个嵌套在一个视图中的区域的视图。导航记录支持,即时视图创建,导航时传递上下文,视图和视图模型参与导航,和使用导航作为程序模块化和组合UI的一部分。 |
事件聚合快速入门 |
Event Aggregation |
This QuickStart demonstrates how to build a WPF application that uses the Event Aggregator service. This service enables you to establish loosely coupled communications between components in your application. 此示例描述了怎样构建一个使用了事件聚合的WPF应用程序。此服务可以让你的组件可以松耦合的通信。 |
交互快速入门 |
Interactivity |
This QuickStart demonstrates how to create a view and view model that work together when the view model needs to interact with the user or user gesture needs to raise an event that invokes a command. In each of these scenarios the view model should not need to know about the view. The first scenario is handled by using and InteractionRequestTriggers. The second scenario is handled by InvokeCommandAction. 此示例展示了怎样让视图和视图模型共同工作,当视图模型需要和用户交互式时。视图模型不需要知道视图。第一个场景是用InteractionRequestTriggers 处理交互。第二个场景使用InvokeCommandAction 处理交互。 |
Step 3: Compile and Run QuickStarts, Reference Implementation, or Prism Library Source Code 第三步:编译和运行快速入门,参考实现,或者Prism源代码
In order to build and run the reference implementation and the QuickStarts, select the appropriate shortcut file and press F5 to build and run.
为了构建和运行参考实现和快速入门,需要选择对应的快捷文件并按F5编译运行。
The reference implementation and QuickStarts use NuGet references to the Prism library assemblies so you can compile and run each solution directly.
参考实现和快速入门中的Prism程序集是用的NuGet引用,所有你可以直接编译并运行它们。
Adding Prism Library Source Projects to Solutions 添加Prism库源项目到解决方案
As part of shipping the Prism Library as NuGet packages, the Prism Library projects were removed from the solutions of all QuickStarts and reference implementation projects. If you are a developer accustomed to stepping through the Prism Library code as you build your application, there are a couple of options:
快速入门,参考实现,这些示例内都是用NuGet包来引用的Prism程序集,你要想使用Prism源代码,有以下选择:
- Add the Prism Library Projects back in. To do this, right-click the solution, point to Add, and then click Existing project. Select the Prism Library projects. Then, to prevent inadvertently building these, click Configuration Manager on the Build menu, and then clear the Build check box for all Prism Library projects in both the debug and release configurations.
- Set a breakpoint and step in. Set a break point in your application's bootstrapper, and then step in to a method within the base class (F11 is the typical C# keyboard shortcut for this). You may be asked to locate the Prism Library source code, but often, the full program database (PDB) file is available and the file will simply open. You may set breakpoints in any Prism Library project by opening the file and setting the breakpoint.