Prism Tech Ed India

Preview:

Citation preview

Developing Line of Business apps using WPF and Silverlight

Blaine WastellProgram ManagerMicrosoftSession Code:

AgendaWhat Is Prism and What Does It Do?

Client Application ChallengesWhat’s In The Box?

Modularity PatternsUI Composition PatternsSeparated Presentation PatternsCommanding & Eventing PatternsMulti-Targeting Sharing Code Between WPF And Silverlight

The Challenge

The Solution

The Problem:Client Applications are Challenging!Beyond the Bling – How To Make The ApplicationDynamic, Customizable, Extensible, Testable?

The Solution:Break App Into PiecesManage Dependencies Between PiecesRe-assemble App From Pieces

Prism – Patterns For Composite Client Apps

Composite Client Applications

Prism – Composite Client Application Guidance for WPF and Silverlight

LibraryReference ImplementationDocumentationQuick-Starts & How-To’sCommunity – CodePlex

Prism 1.0 – WPFReleased July 2008

Prism 2.0 – WPF & SilverlightReleased Feb 2009

Prism – What’s In The Box?

Reference Implementation

The StockTrader Reference Implementation

demo

Prism Core Concepts

Modules

Unit Of Application AssemblyCollection of Related ComponentsFeature, Services, Views, Data AccessSlice & Dice: Mandatory, Optional, Role Specific

Unit Of DevelopmentIndependent DevelopmentIndependent Testing

Unit Of DeploymentUp-Front, Background or On-Demand

ModulesModule Discovery

Pluggable CatalogsModule Loading

Background or On-Demand

Module Loader

Extended InPrism 2.0!

XAP

XAP

XAP

Modules and Catalogsdemo

Shell – Application Host WindowRegions – Named Areas For View PlacementViews – Module UI & Presentation LogicView Injection Visual Composition

UI Composition

Region Region

Region<ContentControl RegionManager.RegionName= “DetailsRegion” />

IPositionPresentationModel presentationModel = …;

IRegion mainRegion = regionManager.Regions[ "MainRegion" ];

mainRegion.Add( presentationModel.View );

<ItemsControl RegionManager.RegionName= "MainRegion">

UI Composition

View Discovery Visual Composition:Less ComplexBlack Box ‘App Assembly’ CompositionSelect Views & Pull into Region

Region Region

Region<ContentControl RegionManager.RegionName= "DetailsRegion”/>

<ItemsControl RegionManager.RegionName= "MainRegion”/>

New InPrism 2.0!

regionManager.RegisterViewWithRegion( "MainRegion", typeof( MainView ) );

UI Compositiondemo

Commands and EventsDelegate & Composite Commands

Simplified Command HandlingEvent Aggregator

Loosely Coupled Pub/Sub Events

Module B

CustomerPresenter

Module A

OrderPresenter

EventAggregator

Subscribe

Publ

ish

Event

Separated Presentation

Presenter

Model

View

PresentationModel ModelView

Prism 1.0Supervising PresenterPresentation Model

Prism 2.0More Concrete Guidance on Using These Patterns…“Model-View-ViewModel”How To Be Designer FriendlyModeling Presentation State (Not UI State)Ultra Thin Views – Data Templates

WPF

SILV

ERLI

GH

T

CLR - Silverlight CLR Desktop

BCL BCL

BROWSER DESKTOP

Multi-TargetingUser Experiences

Desktop – In the Office, Full Functionality, Offline CapableRIA – Out of the Office, Functional Subset, Online

How to Share Code & Components?

Controllers

Models

Presenters

Views

Models

Controllers

Presenters

Views

Multi-Targeting: StrategiesStart With LCD – SilverlightSeparated Presentation StrategiesSingle Source, Cross CompiledLinks and Parallel Project StructuresIf Not:

#IF SILVERLIGHTPartial Classes

Partial MethodsSeparate Classes/Services

Multi-Targetingdemo

SummaryPrism 1.0

Library of Patterns for Enterprise Client AppsTargets WPF on the Desktop

Prism 2.0Extends Prism to Silverlight RIA ApplicationsExtended Patterns for UI Composition, Separated Presentation, ModularityMulti-Targeting – Extend user experience & re-use code and components

Download from MSDN & CodePlex

Send us feedback & ideas for Prism 3.0!

Where Can You Find Prismwww.microsoft.com/prismwww.codeplex.com/prismhttp://blogs.msdn.com/blaine

question & answer

© 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS,

IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.