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-to-maintain Windows Presentation Foundation (WPF) desktop applications. Using design patterns such as Model-View-ViewModel (MVVM), Composite View, and Event Aggregator that embody important architectural design principles helps you create a modular application—using loosely coupled components that can evolve independently. These types of applications are known as composite applications.
    Prism帮助更简单的设计丰富,灵活,易维护的WPF桌面程序。其中使用MVVM,组合式视图,事件聚合等设计模式。这很符合一些重要的架构设计及原则。帮助你创建一个模块化的应用程序——可以独立开发松耦合组件。这类应用可以叫做组合式应用。     

    Composite applications typically feature multiple screens, rich user interaction and data visualization, and that embody significant presentation and business logic. These applications typically interact with multiple back-end systems and services and, using a layered architecture, may be physically deployed across multiple tiers. It is expected that the application will evolve significantly over its lifetime in response to new requirements and business opportunities. In short, these applications are "built to last" and "built for change." Applications that do not demand these characteristics may not benefit from using Prism.

    组合式应用程序通常是多屏幕(或者是多窗口?)、丰富的用户交互和数据验证。需要有炫酷的界面和复杂的业务逻辑。组合式应用通常也会和多个后台系统和服务交互,有可能要使用分成架构,部署在多个物理层上。在软件开发的生命周期里,要应对新需求或是商业机会。简而言之,利用Prism构建的程序是“为以后而构建”和“为改变而构建”。程序没有以上这些特性那或许不需要使用Prism。

    Prism includes reference implementations, QuickStarts, reusable library code (the Prism Library), and extensive documentation. This version of Prism targets the Microsoft .NET Framework 4.5 and includes new guidance around the Model-View-ViewModel (MVVM) pattern, navigation, and the Managed Extensibility Framework (MEF). Because Prism is built on the .NET Framework 4.5 (which includes WPF) , familiarity with these technologies is useful for evaluating and adopting Prism.

    Prism包括一些参考实现,快速入门可复用的类库代码(Prism类库),和大量文档。此版本的Prism的目标框架式Microsoft .NET Framework 4.5 并包含一些指南,MVVM模式,导航,和MEF。由于Prism建立在 .NET Framework 4.5上,熟悉 .NET Framework 4.5是对评估和采用Prism很有用的。

    It should be noted that while Prism is not difficult to learn, developers must be ready and willing to embrace patterns and practices that may be new to them. Management understanding and commitment is crucial, and the project deadline must accommodate an investment of time up front for learning these patterns and practices.

    值得注意的是Prism并不难学,但开发者必须学习里面的一些模式,还要进行一些练习。管理者的理解和支持是很必要的(针对公司的学习成本而说),项目的最后期限可以允许开发者学习和练习使用Prism。

    

Why Use Prism? 为什么使用Prism呢?

    Designing and building rich WPF client applications that are flexible and easy to maintain can be challenging. This section describes some of the common challenges you might encounter when building WPF client applications, and describes how Prism helps you to address those challenges.

    设计并构建灵活且易维护的富客户端WPF程序是很有挑战性的。这节描述了一些当我们构建WPF客户端程序常见的问题,并描述了Prism怎样帮你解决这些问题。

Client Application Development Challenges 客户端程序开发所面临的挑战

    Typically, developers of client applications face quite a few challenges. Application requirements can change over time. New business opportunities and challenges may present themselves, new technologies may become available, or even ongoing customer feedback during the development cycle may significantly affect the requirements of the application. Therefore, it is important to build the application so that it is flexible and can be easily modified or extended over time. Designing for this type of flexibility can be hard to accomplish. It requires an architecture that allows individual parts of the application to be independently developed and tested and that can be modified or updated later, in isolation, without affecting the rest of the application.

    通常,客户端程序开发者面临很多挑战。程序需求随着时间会一直更改。新的商机,新的技术或者用户反馈都会影响程序的开发。因此,使程序易扩展,易维护是很重点的。但设计灵活的程序是很难的。它需要一个允许独立开发组件的架构。组件可以单独的测试,更改及发布,并且不影响其他组件。

    Most enterprise applications are sufficiently complex that they require more than one developer, maybe even a large team of developers that includes user interface (UI) designers and localizers in addition to developers. It can be a significant challenge to decide how to design the application so that multiple developers or subteams can work effectively on different pieces of the application independently, yet ensuring that the pieces come together seamlessly when integrated into the application.

    很多的企业级应用程序相当复杂,需要很多程序员来开发,除了开发人员,还需要界面设计师和本地化人员。那么让大家有效的合作,让某个子团队或个人专注于独立的模块,就变得非常困难了。即时大家分工明确,开发各自的模块,将模块完美的集成又是个问题。

    Designing and building applications in a monolithic style can lead to an application that is very difficult and inefficient to maintain. In this case, "monolithic" refers to an application in which the components are very tightly coupled and there is no clear separation between them. Typically, applications designed and built this way suffer from problems that make the developer's life hard. It is difficult to add new features to the system or replace existing features, it is difficult to resolve bugs without breaking other portions of the system, and it is difficult to test and deploy. Also, it impacts the ability of developers and designers to work efficiently together.

    用一种monolithic  方式设计和构建应用程序是困难、低效、不易维护的。"monolithic"指模块紧耦合不易分离。以这种方式工作会让开发者很难挨。添加新功能或替换已有功能都很费劲。没准解决一个模块的bug会引发其他模块出错,程序难以测试和部署,也让开发者和设计者很难有效的一同工作。(太恐怖了)

    

The Composite Approach 组合式应用

    An effective remedy for these challenges is to partition the application into a number of discrete, loosely coupled, semi-independent components that can then be easily integrated together into an application "shell" to form a coherent solution. Applications designed and built this way are often known as composite applications.

    一个有效的补救措施就是让各个模块独立起来,并可以轻松集成到一个“shell”里。这个Shell贯通了整个解决方案。设计和构建这样的程序就叫做组合式应用。

Composite applications provide many benefits, including the following:

组合式应用有很多好处,如下:

  • They allow modules to be individually developed, tested, and deployed by different individuals or subteams; they also allow them to be modified or extended with new functionality more easily, thereby allowing the application to be more easily extended and maintained. Note that even single-person projects experience benefits in creating more testable and maintainable applications using the composite approach.
        模块可以单独开发,测试,部署;单独的更改添加新功能;程序更易扩展及维护。注意单人的项目也可通过使用Prism得到好处,更易测试和维护。
  • They provide a common shell composed of UI components contributed from various modules that interact in a loosely coupled way. This reduces the contention that arises from multiple developers adding new functionality to the UI, and it promotes a common appearance.
        各个松耦合的UI组件组成在shell里。它们之间的通信可以用松耦合的方式。各个UI组件的开发者可以各自为政(用这个词有点过分)。
  • They promote reuse and a clean separation of concerns between the application's horizontal capabilities, such as logging and authentication, and the vertical capabilities, such as business functionality that is specific to your application. This also allows you to more easily manage the dependencies and interactions between application components.
        可以很好的分离(日志,身份校验)这种各个模块都需要用到的功能。业务逻辑功能也可单独处理。更简单的管理组件间依赖和交互。
  • They help maintain a separation of roles by allowing different individuals or subteams to focus on a specific task or piece of functionality according to their focus or expertise. In particular, it provides a cleaner separation between the UI and the business logic of the application—this means the UI designer can focus on creating a richer user experience.
        根据团队或个人所擅长的东西来分配任务,使他们能专注于自己所擅长的模块上。尤其,Prism提供了界面与业务逻辑的清晰分离——这意味着UI设计师可以专注于设计富用户体验。

    Composite applications are highly suited to a range of client application scenarios. For example, a composite application is ideal for creating a rich end-user experience over disparate back-end systems. The following illustration shows an example of this type of a composite application.

    组合式应用广泛适合各种客户应用程序场景。例如,组合式应用可以创建丰富的客户体验,后面连着不同的后台服务。下图显示了一个组合式应用的例子。

    Composite application with multiple back-end systems
    有多个后台系统的组合式应用程序
1: 介绍Prism5.0 Introduction to the Prism Library 5.0 for WPF(英汉对照版)_第1张图片

    In this type of application, the user can be presented with a rich and flexible user experience that provides a task-oriented focus over functionality that spans multiple back-end systems, services, and data stores, where each is represented by one or more dedicated modules. The clean separation between the application logic and the UI allows the application to provide a consistent and differentiated appearance across all constituent modules.

    这种类型的应用,通过横跨多个后台系统,数据库及服务提供面向任务的体验。每个任务都代表了一个或多个独立模块。清晰分离业务路径和界面,可以让我们的程序换汤不换药(换界面样式不换业务逻辑)。

    Additionally, a composite application can be useful when there are independently evolving components in the UI that heavily integrate with each other and that are often maintained by separate teams. The following illustration shows a screen shot of this type of application. Each of the areas highlighted represent independent components that are composed into the UI.

    另外,一个组合式应用程序可以让独立的模块紧密集成,且单独维护。下图说明了一个单窗口程序。每个区域都代表了一个单独的模块。

    Stock Trader Reference Implementation composite application 股票操盘参考实现组合式应用
1: 介绍Prism5.0 Introduction to the Prism Library 5.0 for WPF(英汉对照版)_第2张图片

 In this case, the composite application allows the UI to be dynamic composed. This delivers a flexible user experience. For example, it can allow new functionality to be dynamically added to the application at run time, which enables rich end-user customization and extensibility.

    在这种情况下,组合式应用程序允许UI动态组合。这提供了一个灵活的用户体验。例如,它可以允许新功能动态添加到程序中。

Challenges Not Addressed by Prism Prism不能做到的事

    Although Prism helps you to address many of the challenges you might face when building WPF applications, there are many other challenges that you might face, depending on your application scenario and requirements. For example, Prism does not directly address the following topics:

    尽管Prism帮你解决了很多困难,当然还有些困难不适合用Prism解决。这得根据你的程序所在场景和需求。例如,Prism不能到达成一下需求。

  • Occasional connectivity and data synchronization 间断性的连接和数据同步(不知所云)
  • Service and messaging infrastructure design 服务和消息传递基础结构设计
  • Authentication and authorization 身份验证和授权
  • Application performance 程序性能
  • Application versioning 程序版本控制
  • Error handling and fault tolerance 错误处理和容错

Prerequisites 先决条件

    Prism assumes you have hands-on experience with WPF . There are a few important concepts that Prism uses heavily, and you should become familiar with them. They include the following:

    学习Prism,假设你有WPF实践经验。这里有一些Prism重要的概念,你该熟悉他们。如下:

  • XAML (Extensible Application Markup Language). The language to declaratively define and initialize the user interface in WPF applications.
         XAML (可扩展应用程序标记语言) . 声明式的语法,描绘界面。
  • Data binding. This is how UI elements are connected to components and data in WPF.
         数据绑定 .就是把组件、数据同界面元素联系起来。
  • Resources. These are how styles, data templates, and control templates are created and managed in WPF.
        资源。怎样创建和管理样式,数据模板,控件模板。
  • Commands. These are how user gestures and input are connected to controls.
        命令。将用户的手势或输入连接到控件上。
  • User controls. These are components that provide custom behavior or custom appearance.
        用户控件。可以提供自定义行为或自定义呈现的组件。
  • Dependency properties. These are extensions to the common language runtime (CLR) property system to enable property setting and monitoring in support of data binding, routed commands, and events.
        依赖属性。扩展了CLR(公共语言运行时)属性系统,依赖属性支持数据绑定,路由命令和事件机制。
  • Behaviors. Behaviors are objects that encapsulate interactive functionality that can be easily applied to controls in the user interface.
        行为。行为时一种封装了交互行为的对象,可以轻松添加到界面中的控件上。

An Overview of Prism Prism概观

 

Architectural Goals 架构目标

The guidance is designed to help architects and developers achieve the following objectives:

此指南意图帮助架构师和开发者实现以下目标:

  • Create an application from modules that can be built, assembled and, optionally, deployed by independent teams using WPF.
        创建一个由多个可独立创建,编辑,部署的组件组成的WPF程序。
  • Minimize cross-team dependencies and allow teams to specialize in different areas, such as user interface (UI) design, business logic implementation, and infrastructure code development.
        尽量减少跨团队的依赖,各团队可以专注于自己的领域,例如界面设计,业务逻辑实现,和基础代码开发。
  • Use an architecture that promotes reusability across independent teams.
        使用一种让各个独立团队复用代码的架构。
  • Increase the quality of applications by abstracting common services that are available to all the teams.
        通过抽象公共服务提高程序的质量,这有利于所有的团队。
  • Incrementally integrate new capabilities.
         逐步整合新的功能。

Prism Design Goals Prism设计目标

    Prism was designed to help you design and build rich, flexible, and easy-to-maintain WPF applications. The Prism Library implements design patterns that embody important architectural design principles, such as separation of concerns and loose coupling. Using the design patterns and capabilities provided by the Prism Library, you can design and build applications using loosely coupled components that can evolve independently but that can be easily and seamlessly integrated into the overall application.

       Prism帮助更简单的设计丰富,灵活,易维护的WPF桌面程序。其中使用MVVM,组合式视图,事件聚合等设计模式。这很符合一些重要的架构设计及原则。 (一句话非得说很多遍吗?当我们记不住吗?)。使用Prism提供的设计模式和功能,你可以设计和构建由一个松耦合组件组成的程序,组件可以独立开发和集成的。(真的好墨迹,都强调好几遍这个概念了)

Prism is designed around the core architectural design principles of separation of concerns and loose coupling. This allows Prism to provide many benefits, including the following:

Prism的核心设计原则是分离关注点和松耦合。因此Prism为我们的开发提供了很多好处,如下:

  • Reuse. Prism promotes reuse by allowing components and services to be easily developed, tested and integrated into one or more applications. Reuse can be achieved at the component level through the reuse of unit-tested components that can be easily discovered and integrated at run time through dependency injection, and at the application level through the use of modules that encapsulate application-level capabilities that can be reused across applications.
           重复: Prism允许组件和服务可以很容易地开发,测试,集成到一个或多个应用程序中,进而促进重用。在组件级别上,通过依赖注入,单元测试组件的重用可以轻松在运行时发现和集成。在程序级别上,模块可以在不同应用程序中重用。
  • Extensibility. Prism helps to create applications that are easy to extend by managing component dependencies, allowing components to be more easily integrated or replaced with alternative implementations at run time, and by providing the ability to decompose an application into modules that can be independently updated and deployed. Many of the components in the Prism Library itself can also be extended or replaced.
         可扩展性。Prism帮助我们通过管理组件依赖关系创建易扩展的程序。允许组件更简单的集成或替换。组件式可以单独更新和部署的。组件本书同样允许被扩展或替换。
  • Flexibility. Prism helps to create flexible applications by allowing them to be more easily updated as new capabilities are developed and integrated. Prism also allows WPF applications to be developed using common services and components, allowing the application to be deployed and consumed in the most appropriate way. It also allows applications to provide different experiences based on role or configuration.
         灵活性。Prism帮助我们创建灵活的应用程序,允许它们更简单的开发并集成新功能。Prism也允许使用公共的服务或组件开发程序,允许你用最恰当的形式开发程序。也允许程序根据角色或配置提供不用的用户体验。
  • Team Development. Prism promotes team development by allowing separate teams to develop and even deploy different parts of the application independently. Prism helps to minimize cross-team dependencies and allows teams to focus on different functional areas (such as UI design, business logic implementation, and infrastructure code development), or on different business-level functional areas (such as profile, sales, inventory, or logistics).
         团队开发。Prism允许子团队单独开发程序的一部分,甚至是单独部署。Prism让团队之间的依赖程序最小化,以便团队只关注自己的领域(例如UI设计,业务逻辑实现,和集成代码开发),或者不同的业务逻辑基本的功能领域(例如 profile, sales, inventory, 或 logistics )
  • Quality. Prism can help to increase the quality of applications by allowing common services and components to be fully tested and made available to the development teams. In addition, by providing fully tested implementations of common design patterns, and the guidance needed to fully leverage them, Prism allows development teams to focus on their application requirements instead of implementing and testing infrastructure code.
        质量。利用Prism制作 充分测试的 公共服务和组件, Prism可以帮助提升应用程序的质量,这对团队是非常有利的。另外,充分利用Prism中的设计模式,Prism允许团队关注于程序需求而不是实现和测试的基础代码。

    It is important to note that Prism was designed so that you can use any of Prism's capabilities and design patterns individually, or all together, depending on your requirements and your application scenario. Prism was designed so that it could be incrementally adopted, allowing you to use the capabilities and design patterns that make sense for your particular application without requiring major structural changes.

    值得注意的是你可以灵活的使用Prism的某一功能或全部功能。Prism也允许你的程序逐步改变。

    Finally, because software testing should be considered a first-class development activity and tightly integrated into the development process, Prism provides extensive support for various types of software testing, thereby allowing you to design and build applications that are easy to test. Prism itself was developed with testing in mind. It was developed to meet multiple strict quality gates to ensure that it meets Microsoft security standards and that it will function correctly on multiple operating systems, with multiple versions of Visual Studio, and with multiple programming languages. Unit tests were run after each check-in. In addition, the Prism library was tested against several additional quality gates, as listed in the following table.

    最后,因为软件测试是软件开会的重中之重,并且集成在软件开发的过程中。Prism支持了各种类型的开发测试,从而允许我们轻松测试程序。Prism本身就伴随着测试开发。Prism的开发满足了多种严格的质量把关,以确保它符合微软的安全标准,并且正常工作在多个操作系统,多个版本的Visual Studio,多种语言。每次签入都进行了单元测试。额外的,Prism库经过了一些测试,如下表:

Test

测试

Description

描述

Acceptance Testing

验收测试

Validates the application functionality using user scenarios to drive the test requirements. Tests can be executed manually or automated.

使用用户场景来驱动测试需求,借以验证程序公共,测试自动或手动执行。

Application Building Exercises

应用程序构建演练

Team members build applications consuming the deliverable software.

团队程序构建应用来消费交付的软件(不知所云)

Black Box Testing

黑盒测试

Manual acceptance tests perform from the user point of view.

以用户角度人工验收。

Cross Platform Testing

跨平台测试

All automated tests are run on multiple platforms.

在多个平台上运行所有的自动化测试。

Globalization Testing

全球化测试

All automated tests are run on multiple languages.

在多种语言环境下运行所有的自动化测试。

Performance Testing

性能测试

Measures how fast a particular aspect of a system performs under-load.

在系统特定方面负载情况下测试运行速度。

Security Review

安全审查

Internal Microsoft security audit standards that cover thread models, identifying attack factors and running the code though security analysis tools.

微软内部的安全审计标准,包含线程模型,识别攻击因素和通过安全分析工具运行代码。

Stress Testing

压力测试

Measures stability of the system under extreme loads; specifically looking to drive out issues like memory leaks and threading issues.

在极端负载情况下测试程序稳定性;特别是寻找内存泄露核线程问题。

White Box Testing

白盒测试

In-depth source code analysis validating the coding standards, structure and how it maps to the overall architecture.

深入代码分析验证代码标准,结构和架构脉络。

    The Prism Library source code includes unit and UI automation tests, as shown in the following table. You can use these as an educational resource, or you can run the tests against the Prism Library itself. This allows you to customize, re-compile, test and deploy a modified version of the Prism Library using similar quality gates as the Prism team.

    Prism类库源代码包含单元和UI自动化测试,如下表。你可以当其为一个教育资源,或者你可以允许来测试Prism。这允许你自定义,重新编译,测试和部署一个更改的Prism类库。

Test

测试    

Description

描述

UI Automation Tests

UI自动化测试

Limited range of acceptance testing; driving the application from the user perspective

有限范围内测试;从用户角度驱动测序

Unit Tests

单元测试

Validates the implementation of a class

验证每个类的实现

Prism Key Concepts Prism关键概念

    Prism provides capabilities and design patterns that may be unfamiliar to you, especially if you're new to design patterns and composite application development. This section provides a brief overview of the main concepts behind Prism and defines some of the terminology that you will see used throughout the documentation and code.

    Prism提供的能力和设计模式也许你还不熟悉,尤其当你刚刚结束设计模式和组合式应用程序开发。这节提供了一个Prism主要概念的概观,这些概念在以后的文档和代码中经常会遇到。

  • Modules. Modules are packages of functionality that can be independently developed, tested, and (optionally) deployed. In many situations, modules are developed and maintained by separate teams. A typical Prism application is built from multiple modules. Modules can be used to represent specific business-related functionality (for example, profile management) and encapsulate all the views, services, and data models required to implement that functionality. Modules can also be used to encapsulate common application infrastructure or services (for example, logging and exception management services) that can be reused across multiple applications.
        模块。模块是可以被独立开发,测试,部署的功能包。许多情况下,由不同的团队开发和维护模块。一个典型的Prism程序都有多个模块。模块可以被用来代表特定业务相关的功能(例如 profile管理 )并且封装了所需功能所有的视图,服务,数据模型。模块也可以封装公共的程序基础设施或服务(例如日志,异常处理服务),这类模块可以在多个程序间复用。
  • Module catalog. In a composite application, modules must be discovered and loaded at run time by the host application. In Prism, a module catalog is used to specify which modules to are to be loaded, when they are loaded, and in what order. The module catalog is used by the ModuleManager and ModuleLoader components, which are responsible for downloading the modules if they are remote, loading the module's assemblies into the application domain, and for initializing the module. Prism allows the module catalog to be specified in different ways, including programmatically using code, declaratively using XAML, or using a configuration file. You can also implement a custom module catalog if you need to.
        模块目录。在组合式应用程序中,模块必须在宿主程序运行时被发现并被下载。在Prism中,模块目录用来指向那个模块盖被加载,加载时机,加载顺序。模块目录的使用是通过 ModuleManager  和 ModuleLoader  组件,可以加载远程组件,并初始化模块。Prism允许模块目录以不同的方式来指定,包括编码指定,XAML指定,或者配置文件指定。你也可以实现一个自定义模块目录。
  • Shell. The shell is the host application into which modules are loaded. The shell defines the overall layout and structure of the application, but it is typically unaware of the exact modules that it will host. It usually implements common application services and infrastructure, but most of the application's functionality and content is implemented within the modules. The shell also provides the top-level window or visual element that will then host the different UI components provided by the loaded modules.
        。壳是一个加载模块的宿主。壳定义了应用程序的整体布局和结构,程序的功能和内容还是在模块中实现的。壳提供了一个顶级窗口或是视图元素,可以用来寄宿来自不同模块的UI组件。
  • Views. Views are UI controls that encapsulate the UI for a particular feature or functional area of the application. Views are used in conjunction with the MVVM pattern, which is used to provide a clean separation of concerns between the UI and the application's presentation logic and data. Views are used to encapsulate the UI and define user interaction behavior, thereby allowing the view to be updated or replaced independently of the underlying application functionality. Views use data binding to interact with view model classes.
         视图。视图是封装了特定功能或程序特定功能区域的UI控件。视图是MVVM模式的一部分,此模式界面,展示逻辑和数据轻松分离。视图封装了UI和定义用户交互行为,从而使视图 独立于底层应用程序 进行更新功能。视图使用数据绑定与视图模型类进行交互。
  • View models. View models are classes that encapsulate the application's presentation logic and state. They are part of the MVVM pattern. View models encapsulate much of the application's functionality.. View models define properties, commands, and events, to which controls in the view can data-bind.
        视图模型。视图模型是封装了程序展示逻辑和状态的类。它也是MVVM模式的一部分。视图模型封装了许多功能,视图模型定义属性,命令和事件,都可以绑定到视图上的控件。
  • Models. Model classes encapsulate the application data and business logic. They are used as part of the MVVM pattern. Models encapsulate data and any associated validation and business rules to ensure data consistency and integrity.
        模型。模型类封装了程序数据和业务逻辑。它也是MVVM模式的一部分。模型封装数据和相关验证和业务规则,确保数据的一致性和完整性。
  • Commands. Commands are used to encapsulate application functionality in a way that allows them to be defined and tested independently of the application's UI. They can be defined as command objects or as command methods in the view model. Prism provides the DelegateCommand class and the CompositeCommand class. The latter is used to represent a collection of commands which are all invoked together.
        命令。命令可以让我们独立的定义和测试程序UI。我们可以在视图模型中定义命令对象或命令方法。Prism提供 DelegateCommand  类和 CompositeCommand  类。后者是用来表示命令的集合,可以一块调用很多命令。
  • Regions. Regions are logical placeholders defined within the application's UI (in the shell or within views) into which views are displayed. Regions allow the layout of the application's UI to be updated without requiring changes to the application logic. Many common controls can be used as a region, allowing views to be automatically displayed within controls, such as aContentControlItemsControlListBox, or TabControl. Views can be displayed within a region programmatically or automatically. Prism also provides support for implementing navigation with regions. Regions can be located by other components through the RegionManager component, which uses RegionAdapter and RegionBehavior components to coordinate the display of views within specific regions.
        区域。区域是应用程序的界面中的逻辑占位符(在壳或是视图里)。以便展示视图。区域允许而无需更改应用程序逻辑代码的情况下更改应用程序UI的布局。许多控件可以作为一个区域,允许视图内的控件会自动显示,例如 ContentControlItemsControlListBox , 或  TabControl 。视图可以以编程或自动的方式展示到区域里。Prism也支持区域导航的实现。区域可以在组件中定义,用 RegionManager  来管理组件。使用 RegionAdapter  和 RegionBehavior  组件来协调区域内视图的展示。
  • Navigation. Navigation is defined as the process by which the application coordinates changes to its UI as a result of the user's interaction with the application or internal application state changes. Prism supports two styles of navigation: state-based navigation, where the state of an existing view is updated to implement simple navigation scenarios, and view-switching navigation, where new views are created and old views replaced within the application's UI. View-switching navigation uses a Uniform Resource Identifier (URI)–based navigation mechanism in conjunction with Prism regions to allow flexible navigation schemes to be implemented.
          导航。导航被定义为一种界面改变的过程,由用户操作或程序内部状态的改变而引起。Prism支持两种方式的导航:基于状态导航,更新视图的状态以实现导航场景。还有视图切换导航,新建一个视图替换旧视图以实现导航。视图切换导航采用的是统一资源标识符( URI )为基础的导航机制,同Prism区域一起实现了灵活的导航方案。
  • EventAggregator. Components in a composite application often need to communicate with other components and services in the application in a loosely coupled way. To support this, Prism provides the EventAggregator component, which implements a pub-sub event mechanism, thereby allowing components to publish events and other components to subscribe to those events without either of them requiring a reference to the other. The EventAggregator is often used to allow components defined in different modules to communicate with each other.
        事件聚合。组合式应用程序的组件经常需要松耦合的和其他组件和服务进行通信。为了支持此功能,Prism提供了事件聚合组件,可以事件发布/订阅事件机制,允许组件发布事件其他组件订阅这些事件,组件不需要互相引用。事件聚合经常定义在不同的模块中以用来通信。
  • Dependency injection container. The Dependency Injection (DI) pattern is used throughout Prism to allow the dependencies between components to be managed. Dependency injection allows component dependencies to be fulfilled at run time, and it supports extensibility and testability. Prism is designed to work with Unity or MEF, or with any other dependency injection containers via the ServiceLocator.
        依赖注入容器。依赖注入模式用于管理组件之间的依赖。依赖注入允许组件在运行时建立依赖。并支持扩展型和可测性。Prism可以和Unity或MEF,或者其他使用了 ServiceLocator 的 注入容器一同工作。
  • Services. Services are components that encapsulate non-UI related functionality, such as logging, exception management, and data access. Services can be defined by the application or within a module. Services are often registered with the dependency injection container so that they can be located or constructed as required and used by other components that depend on them.
        服务。服务是指跟界面无关的组件。如日志异常管理,数据访问。服务可以通过程序的模块来定义。服务通过依赖注入容器来注册,以便其他组件使用。
  • Controllers. Controllers are classes that are used to coordinate the construction and initialization of views that are to be displayed in a region within the application's UI. Controllers encapsulate the presentation logic that determines which views are to be displayed. The controller will use Prism's view-switching navigation mechanism, which provides an extensible URI-based navigation mechanism to coordinate the construction and placement of views within regions. The Application Controller pattern defines an abstraction that maps to this responsibility.
        控制器。控制器用来协调构建和初始化在区域中展示的视图。控制器封装了 决定哪个视图该被呈现的呈现 逻辑。控制器将使用Prism的视图切换导航机制, 视图切换导航机制采用的是扩展的统一资源标识符( URI )导航机制,进而用此机制构建和安置区域中的视图 。程序控制器模式定义了一个 抽象的 映射 去完成此类职责。(此处翻译不通,对控制器还不了解。)
  • Bootstrapper. The Bootstrapper component is used by the application to initialize the various Prism components and services. It is used to initialize the dependency injection container to register any application-level components and services with it. It is also used to configure and initialize the module catalog and the shell's view and view model or presenter.
        引导器。引导器组件用于初始化程序的组件和服务。它被用来初始化依赖注入容器,用以注册程序级别的组件或服务。它也被用来配置和初始化模块目录,还有壳视图和视图模型或呈现器。

    Prism is designed so that you can use any of the preceding capabilities and design patterns individually, or all together, depending on your requirements and your application scenario. You can use the MVVM pattern, modularity, regions, commands, or events in any combination without having to adopt all of them. Of course, if you want to take full advantage of the benefits that separation of concerns and loose coupling offers, you will typically use many of Prism's capabilities and design patterns in conjunction with each other. The following illustration shows a typical Prism application architecture and shows how all the various capabilities of Prism can work together within a multi-module composite application.

    棱镜的设计,使您可以单独或一起使用符合上述任何一项功能和设计模式,这取决于你的需求和你的程序场景。你可以使用MVVM模式,模块化,区域,命令,或者事件。当然,如果你想要充分利用分离关注点和松耦合的优势,你应该组合使用Prism中的各种功能和设计模式。下图展示了一个典型的Prism程序架构,并展示了Prism的各类功能如何共同工作在一个多模块的组合式应用中。

   1: 介绍Prism5.0 Introduction to the Prism Library 5.0 for WPF(英汉对照版)_第3张图片

Typical composite application architecture with the Prism Library 利用Prsim的典型组合式应用程序架构
 

    Most Prism applications consist of a shell application that defines regions for displaying top-level views and shared services that can be accessed by the loaded modules. The shell defines a suitable catalog to specify which modules are to be loaded at startup time , as appropriate. A dependency injection container is also defined, which allows component dependencies to be fulfilled at run time. Shared services and components are registered with the container by the Bootstrapper when the application starts.

    大多数Prism应用程序有一个定义了通过加载模块展示区域的顶级视图和可访问的共享服务的壳应用程序组成。壳中定义了一个合适的目录,指示哪些模板应该在启动时加载(或需要使用时)。一个依赖注入容器同样被定义,允许组件依赖关系在运行时执行。当程序启动时,Bootstrapper会注册共享服务和组件被注册到容器中。

    Individual modules encapsulate a portion of the overall application's functionality and, using a separated presentation pattern such as MVVM, define views, view models, models, and service components. When the modules are loaded, views defined within the modules are displayed within the regions defined by the shell. After initialization completes, the user then navigates within the application using state-based or view-switching navigation to coordinate the visual update or display of new views within the application's regions.

·    独立的模块封装了整个程序的部分功能,使用了分离呈现的模式如MVVM,定义视图,视图模型,模型,和公共组件。当组件被加载,模块中定义的视图被呈现到壳定义的区域中。初始化结束之后,用户可以利用导航切换视图。

Using Prism 使用Prism

    Now that you've seen the major capabilities and design patterns that Prism supports, it's time to see how easily you can start to use Prism when developing a new application. This section provides an overview of the first few steps required to create a basic Prism application. You can extend this basic application to leverage the additional capabilities and design patterns provided by Prism, as required by your scenario.

    现在你将看到Prism支持的主要功能和设计模式,入门还算容易。本节提供了需一个要几步来创建的基本的Prism项目。你可以扩展这个项目来尝试Prism中的功能及设计模式,以达到你自己的要求。

Note:注意
Although the Prism Library can be easily used to build new composite WPF applications, you can also use Prism with existing applications that want to take advantage of one or more Prism capabilities or design patterns.
尽管Prism可以轻松创建一个新的组合式WPF应用程序。你也可以使用Prism的好处来改善已有的程序。

    A Prism application typically consists of a shell project and multiple module projects. The following illustration shows common activities needed when developing a composite application using the Prism Library.

    一个Prism应用程序通常有一个壳项目和多个模块项目组成。下图展示了使用Prism开发组合式应用常需要的操作。

  1: 介绍Prism5.0 Introduction to the Prism Library 5.0 for WPF(英汉对照版)_第4张图片

Activities for creating a composite application 创建一个组合式应用的操作

    A typical Prism application leverages most or all of the Prism capabilities and design patterns described earlier to be able to fully realize the benefits of the loose coupling and separation of concerns architectural design principles. However, for this example, the steps required to create a basic Prism application that consists of a single module that defines a single view are described.

    一个典型的Prism应用可以让你意识到松耦合和分离关注点是多么美妙。然而,这个例子,只有一个模块组成。

Note:注意
Prism Library References Prism类库参考
Most of your projects will need to reference the Prism Library assemblies. Prism provides signed binaries through NuGet packages so that you can use the Visual Studio Manage NuGet Packagesdialog box to add references to them. You can also include the Prism Library projects in your solution and then use project references to them. The latter has the advantage of being able to use features like Go To Definition to step down into the Prism types, as well as being able to build and sign the Prism Library assemblies with your own strong name or certificate as part of your build process.
你大多数程序将需要引用Prism程序集。Prism通过NuGet包提供签署的程序集,以便于你能利用Visual Studio管理包工具引用到它们。你也可以包含Prism源代码项目到你的解决方案里。后者的优点是你可以单步调试到Prism的类中,也可以构建和签署Prism程序集形成你自己的强命名或证书作为你构建过程的一部分。

Define the Shell 定义壳

    The application shell provides the basic layout for the application. This layout is defined using regions that modules can use to place views. Views, like shells, can use regions to define discoverable areas that content can be added to, as shown in the following illustration. Shells typically set the appearance for the entire application and contain the styles that are used throughout the application.

    程序壳为程序提供了一个基本布局。这个布局可以使模块放置视图到区域中。视图,跟壳很像,可以使用区域去定义发现区域,然后视图去当做区域的内容被添加,如下图所示。

壳通常设置整个应用程序的外观,包含样式也用于在整个应用程序。

  1: 介绍Prism5.0 Introduction to the Prism Library 5.0 for WPF(英汉对照版)_第5张图片

Shells, views, and regions 壳,视图和区域

 

Create the Bootstrapper 创建Bootstrapper

    The bootstrapper is the glue that connects the application with the Prism Library services and the Unity or MEF containers. Each application creates an application-specific bootstrapper, which typically inherits from either UnityBootstrapper or MefBootstrapper, as shown in the following illustration. You will need to decide the approach you want to use to populate the module catalog. Minimally, each application will provide a module catalog and a shell.

    引导器是应用程序连接Prism类库服务和Unity或是MEF容器的胶水。每个程序都要创建属于自己的引导器,继承自 UnityBootstrapper 或是 MefBootstrapper, 如下图所示。你需要决定你要使用填充模块目录的方法。最低限度,每个程序都会提供一个模块目录和一个壳。

    By default, the bootstrapper logs events using the .NET Framework Trace class. Most applications will want to supply their own logging services, such as Enterprise Library logging. Applications can supply their logging service in their bootstrapper.

    默认情况,引导器日志时间使用的是 .NET Framework Trace 类。大多数应用程序想要支持自己的日志服务,例如微软企业库日志。程序可以在他们的引导器中设置他们自己的日志服务。

    By default, the UnityBootstrapper and MefBootstrapper enable the Prism Library services. These can be disabled or replaced in your application-specific bootstrapper.

    默认情况,UnityBootstrapper 和MefBootstrapper 启用Prism服务。这些以在你的引导器中禁用或替换。

  1: 介绍Prism5.0 Introduction to the Prism Library 5.0 for WPF(英汉对照版)_第6张图片

Diagram demonstrating connecting to the Prism Library 图例示范连接Prism库

Create the Module 创建模块

    The module contains the views and services specific to a piece of the application's functionality. Frequently, these are contained in separate assemblies and developed by separate teams. A module is denoted by a class that implements the IModule interface. These modules, during initialization, register their views and services and may add one or more views to the shell. Depending on your module discovery approach, you may need to apply attributes to your module classes or define dependencies between your modules.

    模块包含视图和程序功能相关服务。大多时候,模块都是由一个单独的团队开发的。一个模块由一个实现了IModule 接口的类为入口。这些模块,在实例化期间,注册模块的视图到壳里。依赖于你模块发现方法,您可能需要的属性应用到你的模块类或模块之间定义的依赖关系。

Add a Module View to the Shell 添加一个模块视图到壳里

    Modules take advantage of the shell's regions for placing content. During initialization, modules use the RegionManager to locate regions in the shell and add one or more views to those regions or register one or more view types to be created within those regions. The RegionManager is responsible for keeping track of regions throughout the application and is a core service initialized from the bootstrapper.

    模块利用shell的区域放置内容。在实例化期间,模块使用RegionManager 把一个或多个视图定位到壳的区域里。或注册要在区域建立一个或多个视图的视图类型到这个区域里。RegionManager 保持跟踪整个应用程序的区域,RegionManager 是一个核心服务,它在引导器中被初始化。

The remaining topics in this guide provide details about Prism key concepts.

Exploring Prism 浏览Prism

Prism consists of the following:

Prism有以下组成:

  • Prism Library source code. The source code for the Prism Library assemblies, including the core Prism functionality, plus Unity and MEF extensions, which provide additional components for using Prism with the Unity Application Block (Unity) and the Managed Extensibility Framework. The source code also includes Prism.PubSubEvents and Prism.Mvvm assemblies.
         Prism类库源代码.      源码包含了核心Prism功能,Unity和MEF扩展,这俩组件在   Unity Application Block  (Unity) 和  Managed Extensibility Framework .  源码同样包含 Prism.PubSubEvents 和Prism.Mvvm 程序集  。
  • Prism binary assemblies. Signed binary versions of the Prism Library assemblies. These assemblies can be downloaded from NuGet by searching for Prism, Prism.Composition, Prism.PubSubEvents, and Prism.Mvvm, Prism.Interactivity, Prism.UnityExtensions, and Prism.MefExtensions. These NuGet packages will load dependencies such as the Unity Application Block and the Service Locator.

    Prism程序集.  签署的二进制版本的Prism程序集。这些程序集可以从NuGet工具下载,你可以查找关键词Prism, Prism.Composition, Prism.PubSubEvents, and Prism.Mvvm, Prism.Interactivity, Prism.UnityExtensions, 和Prism.MefExtensions. 这些NuGet包也会下载它的依赖项,例如  Unity Application Block 和 Service Locator. 
    Note:注意
    The Prism NuGet package will download the Prism.Composition, Prism.PubSubEvents, Prism.Mvvm, Prism.Interactivity, Prism.PubSubEvents, and Prism.Mvvm NuGet packages.
    下载Prism NuGet包将下载Prism.Composition, Prism.PubSubEvents, Prism.Mvvm, Prism.Interactivity, Prism.PubSubEvents, 和Prism.Mvvm NuGet 包.
  • Code samples. Prism includes a reference implementation sample and QuickStart samples. The Stock Trader Reference Implementation is a comprehensive sample application that illustrates how Prism can be used to implement real-world application scenarios. The reference implementation is intentionally incomplete, but they illustrate how many of the patterns in Prism can work together within a single application. The QuickStart samples include several small, focused sample applications that illustrate the MVVM pattern, navigation, UI composition, modularity, commanding, event aggregation, and interactivity.
         代码示例.    Prism  包含一个参考实现和一些快速入门示例 。股票操盘参考示例是一个全面的程序示例,模拟了真实世界的场景。此参考实现是故意不完整的,单它说明了很多Prism的知识点。快速入门示例包含一些介绍Prism单一功能的示例,知识点有MVVM模式,导航,组合式UI,模块化,命令,世界聚合,和交互。
  • Documentation. The Prism 5.0 documentation provides an overview of the goals and concepts behind Prism and detailed guidance on using each of the capabilities and design patterns provided by Prism. The next section provides an overview of the topics covered.
          文档.   Prism 5.0文档提供了一个目标和概念的概观。还有Prism功能和设计模式的详细介绍。下一节提供涵盖了文档内各主题的概述。

Exploring the Documentation 浏览文档

    The Prism documentation spans a wide range of topics, including an overview of common development challenges and the composite application approach, an overview of the Prism Library and the design patterns that it implements, as well as step-by-step instructions for using the Prism Library during development. The documentation is intended to appeal to a broad technical audience to help the reader to understand and use Prism within their own applications. The documentation includes the following:

    Prism 文档涵盖了广泛的主题,包含一般的开发挑战概述和组合式应用方法,Prism库的概述和里面设计模式的实现,也有一步一步的介绍使用Prism开发。本文档的目的是帮助广大技术受众理解和在自己的应用程序中使用Prism。

  • Initializing Applications. This topic discusses what needs to happen to get a modular Prism application up and running.
         初始化应用程序 .  这篇讨论一个Prism启动并运行都发生了什么。
  • Managing Dependencies Between Components. Applications based on the Prism Library rely on a dependency injection container. Although Prism has the ability to work with nearly any dependency injection container, the Prism Library provides two default options for dependency injection containers: Unity or MEF. This topic discusses the different capabilities and what you need to think about when working with a dependency injection container.
         组件间的依赖关系管理 .  基于Prism的程序要依靠依赖注入容器。尽管Prism可以和任何依赖注入容器一起工作,但Prism提供了两个默认的容器:Unity或MEF。这篇讨论了两容器不同的功能和你怎样选择适合你程序的依赖注入容器。
  • Modular Application Development. This topic discusses the core concepts, key decisions, and core scenarios when you create a modular client application with Prism.
         模块化应用程序开发 .  这篇讨论了当你用Prism创建一个模块化客户端程序的核心概念,关键决断,和核心场景
  • Implementing the MVVM Pattern. Using the MVVM pattern, you separate the UI of your application and the underlying presentation and business logic into three separate classes: the view, model, and view model. This topic discusses the core concepts behind the MVVM pattern and describes how to implement it in your application using Prism.
         实现MVVM模式 .  使用MVVM模式,你可以将UI,呈现逻辑,业务逻辑分离到三个类库:视图,模型,视图模型。这篇讨论MVVM模式的核心概念和怎样在Prism程序中应用。
  • Advanced MVVM Scenarios. This topic provides guidance on implementing more advanced scenarios using the MVVM pattern, including how to implement composite commands (commands that represent a group of commands), and how to handle asynchronous web service and user interactions. This topic also provides guidance on using a dependency injection container, such as Unity or MEF, to handle the construction and wire-up of the MVVM classes.
         进击的MVVM .  此篇提供了在更复杂的情况下使用MVVM模式,包含组合式命令(一个命令里包含多个命令),怎样处理异步Web服务和用户交互行为。这篇也介绍了依赖注入容器怎样处理构建和粘合MVVM的类库们。
  • Composing the User Interface. Regions are placeholders that allow a developer to specify where views will be displayed in the application's UI. In Prism, there are two approaches to displaying views in a region: view discovery and view injection. This topic describes how to work with regions and the UI. It also includes information for UI designers to understand composite applications.
         组合式用户界面 .  区域是一种占位符,允许开发人员把各个模块的视图放进去。在Prism中,有两种方式在区域中展示视图:视图发现和视图注入。此篇描述怎样了利用区域工作。它也包含怎样让设计师里加尔组合式应用。
  • Navigation. Navigation is the process by which the application coordinates changes to its UI as a result of the user's interaction with the application or internal application state changes. This topic provides guidance on implementing state-based navigation, where the state of the UI in a view is updated to reflect navigation, and view-switching navigation, where a new view is created and displayed in a region.
         导航 . 导航被定义为一种界面改变的过程,由用户操作或程序内部状态的改变而引起。此篇介绍怎样实现基于状态的导航,当视图状态被更新以反映到导航上,还有视图切换导航,当一个新的视图被创建并要展示到区域里。
  • Communicating Between Loosely Coupled Components. This topic discusses the various options for communicating between components in different modules, using commanding, the EventAggregator, region context, and shared services.
         松耦合组件间的通信 .  此篇讨论组间的通信,利用命令,事件聚合,区域上下文,和共享服务。
  • Deploying Applications. This topic addresses deployment considerations for Prism WPF applications.
         部署应用程序 . 此篇讲述部署Prism WPF 程序注意事项。
  • Glossary. This appendix provides a concise summary of the terms, concepts, design patterns and capabilities provided by Prism.
          词汇 .  本附录提供的Prism术语,概念,设计模式及功能简要说明。
  • Patterns in the Prism Library. This appendix describes the software design patterns applied in the Prism Library and the Stock Trader RI. This topic primarily targets architects and developers wanting to familiarize themselves with the patterns used to address the challenges in building composite applications.
         Prism中的模式 .本附录介绍了Prism库在 股票交易 软件的设计模式。此篇目的是让架构师和开发者熟悉模式以便完成构建组合应用程序的挑战。
  • Prism Library. This appendix provides an overview of the Prism Library for WPF.
         Prism库 . 此附录提供了Prsm库的概观。  
  • Upgrading from Prism Library 4.1. This appendix discusses what you need to know if you are upgrading from previous versions of Prism.
         从Prism4.0升级 .  此附录讨论怎样从之前的版本升级。
  • Extending the Prism Library. This appendix discusses how you can extend Prism modularity, behaviors, and navigation.
         扩展Prism库 .  此附录讨论怎样扩展Prism模块化,行为和导航。
  • Code Samples. Prism includes the source code for several samples that demonstrate key concepts. For more information, see the next section, "Code Samples Using the Prism Library for WPF."
         代码示例 .  Prism包含一些示例源代码,演示了些关键概念。更多信息,请看下一节,“使用Prism库代码示例”。
  • Getting Started Using the Prism Library Hands-On Lab. This hands-on labs demonstrates building a simple composite application, step-by-step, in WPF. It primarily targets developers who want to understand the basic concepts of the Prism Library.
         使用Prism库入门——动手实验室 .  此动手实验室演示一步一步构建一个简单的组合式应用,帮你了解Prism的基本概念。
  • Publishing and Updating Aplications Using the Prism Library Hands-On Lab. This hands-on lab walks you through the process of for publishing and updating a Prism WPF application with ClickOnce.
         发布和更新Prism应用程序——动手实验室. 此实验演示一次点击发布或更新程序。

Exploring the Code Samples 浏览代码示例

    The code samples illustrate specific Prism-related concepts. The samples are an ideal starting point if you want to gain an understanding of a key concept and you are comfortable learning new techniques by examining source code. Prism includes the following:

    代码示例说明了一些Prism相关的概念。研究示例是个好的起点,可以迅速了解一些关键概念并通过实践学习新技术,示例如下:

  • Stock Trader Reference Implementation. The Stock Trader RI is a composite application that demonstrates an implementation of the baseline architecture using the Prism Library.
         股票操盘参考实现 .  股票操盘程序是一个演示了Prism基本架构的组合式应用。
  • Modularity QuickStarts. These QuickStarts demonstrate how to build WPF applications composed of modules. The modules can be statically loaded, when the shell contains a reference to the module's assembly, or dynamically loaded, when modules are dynamically discovered and loaded at run time. The QuickStarts also demonstrate using the Unity container and MEF.
         模块化快速入门 . 描述了怎样构建程序的模块。当壳程序引用模块程序集时,模块是静态加载的。当模块是动态发现的,模块则动态加载。此示例同样演示了怎样使用Unity和MEF容器。
  • Interactivity QuickStart. 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 a 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 InteractionRequests andInteractionRequestTriggers. The second scenario is handled by InvokeCommandAction.
         交互快速入门 .  此快速入门演示了当视图模型需要和用户或用户手势引发的世界或命令进行交互时怎样创建一个视图和视图模型并一同工作。视图模型应该不知道有视图的存在。优先的方案使用   InteractionRequests  和 InteractionRequestTriggers 。第二种方案是用 InvokeCommandAction 处理。
  • MVVM QuickStart. This 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 validation, UI interactions, and data templates.
         MVVM快速入门 .  此快速入门演示了怎样构建一个实现了MVVM模式的程序,还有些开发者会遇到的问题,例如验证,UI交互,和数据模板。
  • Commanding QuickStart. This QuickStart demonstrates how to build a WPF UI that uses commands provided by the Prism.Mvvm Library to handle UI actions in a decoupled way.
         命令快速入门 .  此快速入门演示了怎样使用 Prism.Mvvm库中提供的命令去以松耦合的方式处理UI动作。
  • UI Composition QuickStart. 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快速入门 .  此快速入门演示了怎样构建用不同的视图构建WPF程序。这些视图动态加载到区域里,彼此以松耦合的方式交互。它说明了怎样使用视图发现和视图注入方法来组合UI。
  • State-Based Navigation QuickStart. 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.
         基于状态导航快速入门 .  此快速入门演示了一个定义导航的方法。方法使用了视图状态管理   (VSM)  区定义不同的状态、状态的动画,状态间的切换。
  • View-Switching Navigation QuickStart. 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 QuickStart. 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.
         事件聚合快速入门 .  此入门演示了怎样构建一个使用事件聚合服务的PF应用程序。此服务确保你封装组件间松耦合的通信。

More Information 更多信息

Prism assumes you have hands-on experience with WPF. If you need general information about WPF , see the following resources:

如果你对WPF不甚了解,请看如下资源:

  • Windows Presentation Foundation on MSDN. MSDN上的WPF。
  • MacDonald, Matthew. Pro WPF in C# 2010: Windows Presentation Foundation in .NET 4, Apress, 2010. 这是一本书
  • Nathan, Adam. WPF 4 Unleashed. Sams Publishing, 2010.  这是一本书

Community 社区

Prism's community sites are: Prism的社区网站如下:

  • Prism: http://www.codeplex.com/Prism 
  • PubSubEvents (Event Aggregator): http://www.codeplex.com/pnpPubSub
  • MVVM (Model-View-ViewModel): http://www.codeplex.com/pnpMvvm

    On this these community sites, you can post questions, provide feedback, or connect with other users for sharing ideas. Community members can also help Microsoft plan and test future offerings and download additional content, such as extensions and training material.

    在这些社区网站,你可以提交问题,提供反馈,或者联系其他用户分享想法。社区成员还可以帮助Microsoft规划和测试未来的产品,并下载附加内容,例如扩展和培训材料。

Next Topic |  Previous Topic |  Home |  Community
下一篇 |  上一篇 |  主页 |  社区

 

转载于:https://www.cnblogs.com/DoubleChen/p/3687305.html

你可能感兴趣的:(ui,shell,游戏)