所需积分/C币:9 2011-10-12 15:49:05 9.2MB PDF
收藏 收藏
DEVELOPER S GUIDE TO Microsoft Prism 4 Building Modular MVVM Applications using Windows@ Presentation Foundation and Microsoft Silverlight( Bob Brumfield Geoff cox David hill Brian Noyes Michael puleio Karl Shifflett SBN:9780735656109 This document is provided"as-is" Information and views expressed in this document, including URL and other Internet Web site references may change without notice. You bear the risk of using it. Some examples depicted herein are provided for illustration only and are fictitious No real association or connection is intended or should be inferred o 2011 Microsoft. all rights reserved Microsoft, Windows, Windows Server, Windows Vista, Silverlight, Expression Blend, MSDN, IntelliSense, Visual C#, Visual C++, and Visual Studio are trademarks of the microsoft group of companies All other trademarks are the property of their respective owners Contents T豆 E TEAM V豆 O BROUG豆 T YOU THIS GUIDE The Prism 4 Development Team FOREWORD Ward bell FOREWORD rian Noves 1 Introduction Why Use Prism? Client Application Development Challenges The Composite Approach Challenges Not Addressed by Prism Getting Started with Prism Prerequisites Installing Prism Step 1: Install System requirements Step 2: Extract the Prism Source code Binaries, and documentation Step 3: Register the Prism Binaries Exploring Prism 122245555667778 hat's New in this release What's Included Exploring the Documentation Exploring the quick Starts 10 Exploring the Reference Implementations 11 Upgrading from Earlier releases An Overview of prism 12 Prism Design goals 12 Prism Key Concepts 14 Using prism 17 Defining the shell 19 Creating the bootstrapper 19 Creating a module 20 Adding a Module view to the Shel 21 More Information 21 Communit 22 What Is a Bootstrapper? 23 2 Initializing Prism Applications 23 Dependency Injection Creating the Shell 24 K ey Decisions 25 Core scenarios 25 Creating a Bootstrapper for Your Application 25 Implementing the Create Shell Method 25 Implementing the Initialize Shell Method 26 Creating and Configuring the Module Catalog 26 Creating and Configuring the Container 27 Core services 27 Application-Specific Services Creating and Configuring the Container in the Unity Bootstrapper 28 Creating and Configuring the Container in the MefBootstrapper 29 More Information 31 3 Managing Dependencies Between Components 33 Key Decision: Choosing a Dependency Injection Container 34 Considerations for Using the Container 35 C ore scenarios 36 Registering Types and objects 36 Registering Types with the Unity Container 36 Registering Types with MEF 37 Resolving Types and Objects 37 Resolving Instances with Unity 38 Resolving Instances with MEF 39 Using Dependency Injection Containers and Services in Prism 40 Using service locator 41 Considerations for Using iServicelocator 43 More Information 43 4 Modular Application Development 5 Benefits of Building Modular Applications 6 Prisms Support for Modular Application Development Core Concepts 47 I Module: The Building Block of Modular Applications 47 Module lifetime 8 Module catalo 8 Controlling when to load a module Integrating modules with the application Communication Between modules Dependency Injection and Modular Applications 50 Key decisions 51 Partitioning an Application into Modules 52 Determining the ratio of projects to modules 53 xap File and Module Factoring 54 Using Dependency Injection for Loose Coupling 55 Core scenarios 56 Defining a module 56 Registering and Discovering modules 57 Using Code to register Modules 57 Using a Xaml File to Register Modules 58 Using a configuration file to register modules 59 Discovering Modules in a Directory 60 Loading modules 61 Initializing m 8 odules 61 Specifying Module Dependencies 62 Specifying Dependencies in Code 62 Specifying Dependencies in XAML 62 Specifying Dependencies in a Configuration File 62 Loading Modules on Demand 63 Specifying On-Demand Loading in Code 63 pecifying On-Demand Loading in XAML 63 Specifying On-Demand Loading in a Configuration File 63 Requesting On-Demand Loading of a module 64 Downloading remote modules in the background 64 Preparing a module for remote download 64 Tracking Download Progress 64 Detecting When a Module Has Been Loaded 65 Modules in mef 65 Using mef to Register Modules Programmatically 65 Using mef to Discover Modules in a Directory 66 Using mef to Specify Dependencies in Code 67 Using mef to Specify On-Demand Loading 67 Using mef to prepare a module for remote download 67 More Information 68 Class Responsibilities and Characteristics 69 5 Implementing the MVVM Pattern 69 he view class 70 The view model class 71 The model class 73 Class interactions 74 Data bindin 8 74 Implementing INotify Property Changed 75 mplementing INotify Collection Changed 76 Implementing ICollection View 77 Commands 80 Implementing command objects 80 evoking Command Objects from the View 82 evoking command methods from the view 83 Data Validation and Error Reporting 84 Implementing I Data ErrorInfo 84 mplementing INotify Data ErrorInfo 85 Construction and Configuration 86 Creating the View Model Using XaML 87 Creating the view Model programmatically 87 Creating a View Defined as a Data Template 88 8oo0333V¥o003o Key Decisions 89 More Information 90 Commands 91 6 Advanced mvvm scenarios 91 Composite Commands 92 Registering and Unregistering Child Commands Executing Commands in Active Child Views Commands within Collections 96 Command behaviors 97 Extending prism Command behaviors 98 Handling Asynchronous Interactions 101 Retrieving Data and Interacting with Web Services 101 User Interaction patterns 103 Using an Interaction service 104 Using Interaction Request objects 105 Initiating Interaction Requests from the view model 106 Using Behaviors to Implement the Interaction User Experience 108 Advanced Construction and Configuration 110 Using mef to Create the View and view Model 110 Using Unity to Create the view and view model 111 Using an External Class to Create the View and View Model 113 Testing mvvm applications 114 Testing INotify Property Changed Implementations 114 Testing si ng mple cases esting Computed and Non -Settable Properties 114 Testing Whole object notifications 115 Testing INotify Data ErrorInfo Implementations 115 Testing Validation Rules 115 Testing the Requirements for INotify Data ErrorInfo Implementations116 Testing Asynchronous Service Calls 117 More Information 119 7 Composing the User Interface 121 UI Layout Concepts 122 Shell 123 Views 123 Composite Views 123 Views and Design Patterns 124 Commands, UI Triggers, Actions, and Behaviors 124 Data Binding 125 Regions 125 Region manager 125 Region Implementation 126 Default Region Functionality 128 Extending the Region Implementation 130 View Composition 30 View Discovery 131 View Injection 131 Navigation 131 When to Use view discovery vs. View Injection 131 UI Layout scenarios 132 Implementing the Shell 132 Stock trader ri shel 132 Defining Regions 135 Stock Trader RI Shell Regions 136 i Region 138 Using Xaml to Add a region 139 Using Code to add a region 139 Displaying Views in a Region When the Region Loads 140 Displaying Views in a Region Programmatically 141 Navigation 142 Ordering views in a region 142 Sharing Data Between Multiple Regions 143 Creating Multiple Instances of a Region 145 Creating vi 8 lews 146 User Controls 146 Custom control Data Templates 147 Re esources 147

试读 127P
限时抽奖 低至0.43元/次
身份认证后 购VIP低至7折
  • 分享达人

关注 私信
最新推荐 9积分/C币 立即下载

试读结束, 可继续阅读

9积分/C币 立即下载