Upload
dave-bost
View
2.029
Download
0
Tags:
Embed Size (px)
DESCRIPTION
This is the slide deck of the session I presented at VSLive San Francisco 2009 on Feb. 26, 2009
Citation preview
Shine a Light withShine a Light with“Prism”“Prism”Dave BostDave BostDeveloper Evangelisthttp://davebost.com/blog
Pre-requisites for this presentation:
1) IoC, DI 2) Presentation patterns
Level: Intermediate
http://thirstydeveloper.comhttp://thirstydeveloper.com
“Looking at someone’s code, but with audio”
Session Objectives And Session Objectives And TakeawaysTakeaways Session Objective(s):
– Able to determine RIA composite application scenarios and recommend solutions for the scenarios using Prism for Silverlight and WPF.
Prism – V2 in Feb shipped Feb. ‘09 (Silverlight) Provides written and code-example guidance
for composite solution space Supports targeting both Silverlight & WPF
composite applications
Are you building this?Are you building this?
Or something like this?Or something like this?
The ChallengeThe Challenge
The SolutionThe Solution
Consider PrismConsider Prism
Provides Tools to help with separating your app and composing at run-time:
• Tools to help you discover the pieces• Strategies and guidance for recomposition• Approaches for communication between these separate components• Event help with targeting both Silverlight and WPF
Provides Tools to help with separating your app and composing at run-time:
• Tools to help you discover the pieces• Strategies and guidance for recomposition• Approaches for communication between these separate components• Event help with targeting both Silverlight and WPF
Prism-What’s in the boxPrism-What’s in the box
Prism – Composite Client Application Guidance for WPF and Silverlight– Library– Reference Implementation– Documentation– Quick-Starts & How-To’s– Community – CodePlex
Prism 1.0 – WPF– Released July 2008
Prism 2.0 – Silverlight– Released February 2009
Reference ImplementationReference Implementation
Prism Core ConceptsPrism Core Concepts
ModulesModules
Unit Of Application Assembly– Collection of Related Components
– Feature, Services, Views, Data Access
– Mandatory or Optional or Role Specific
– Example: Banking app: Checking Module, Credit Card Module, Trading Module, News Module
Unit Of Development– Independent Development
– Independent Testing
Unit Of Deployment– Up-Front, Background or On-Demand
ModulesModules Module Discovery
– Pluggable Catalogs
Module Loading– Background or On-Demand
Module Module LoaderLoaderModule Module LoaderLoader
Extended InExtended InPrism 2.0!Prism 2.0!
DemoDemo
Modules & Catalogs
UI CompositionUI Composition Shell – Application Host Window Regions – Named Areas For View Placement Views – Encapsulate UI & Presentation Logic
RegionRegion
RegionRegion
RegionRegion
// View InjectionIPositionPresentationModel presentationModel = …;
IRegion mainRegion = regionManager.Regions[ "MainRegion" ];
mainRegion.Add( presentationModel.View );
<TabControl RegionManager.RegionName= "MainRegion">
<ItemsControl RegionManager.RegionName= “ResearchRegion” />
<ContentControlRegionManager.RegionName= “ActionRegion” />
UI CompositionUI Composition View Discovery Composition:
– Less Complex– Black Box ‘App Assembly’ Composition– Select Views & Pull into Region
New InNew InPrism 2.0!
Prism 2.0!
RegionRegion
RegionRegion
RegionRegion
<TabControl RegionManager.RegionName= "MainRegion">
regionManager. RegisterViewWithRegion( "MainRegion", typeof( MainView ) );
DemoDemo
UI Composition
Commands and EventsCommands and Events
Delegate & Composite Commands– Simplified Command Handling
Event Aggregator– Loosely Coupled Pub/Sub Events
Module BModule B
CustomerPresenterCustomerPresenter
Module AModule A
OrderPresenter
OrderPresenter
EventAggregator
EventAggregator
Subscribe
Publish
Event
Prism Silverlight Logical Prism Silverlight Logical ArchitectureArchitecture
HOST APPLICATIONHOST APPLICATION LOADING SERVICESLOADING SERVICES
CORE SERVICESCORE SERVICES
MODULE PROFFERED SERVICES
MODULE PROFFERED SERVICES
ModulesModulesMODULESMODULES
PresenterPresenter
ModelModel
ViewView
ModelModel
ModuleCatalog
Module Loader
EventAggregator
Logging
RegionManager
Un
ity
Module Initializer
Multi-TargetingMulti-Targeting User Experiences
– Desktop – In the Office, Full Functionality, Offline – RIA – Out of the Office, Functional Subset, Online
WPFApplication
WPFApplication
Silverlight (RIA)Application
Silverlight (RIA)Application
CLR - SilverlightCLR - SilverlightCLR - SilverlightCLR - Silverlight CLR DesktopCLR DesktopCLR DesktopCLR Desktop
BCLBCLBCLBCL BCLBCLBCLBCL
BROWSER DESKTOP
Multi-Targeting: StrategiesMulti-Targeting: Strategies
Start with LCD Use Links and Parallel Project Structures Separated Presentation Strategies Keep single source If not, apply the sieve
#IF SILVERLIGHT#IF SILVERLIGHT
Partial ClassesPartial Classes
Partial MethodsPartial Methods
Separate ClassesSeparate Classes
Rewrite the CodeRewrite the Code
WP
FW
PF
CLR - SilverlightCLR - SilverlightCLR - SilverlightCLR - Silverlight CLR DesktopCLR DesktopCLR DesktopCLR Desktop
BCLBCLBCLBCL BCLBCLBCLBCL
BROWSER DESKTOP
Multi-TargetingMulti-Targeting
ControllersControllers
ModelsModels
PresentersPresenters
ViewsViews
ModelsModels
ControllersControllers
PresentersPresenters
ViewsViews
DemoDemo
Multi-Targeting
Where Can You Find It?Where Can You Find It?
www.microsoft.com/compositewpf www.codeplex.com/compositewpf http://msdn.microsoft.com/practices http://blogs.msdn.com/bobbrum http://blogs.msdn.com/blaine
SummarySummary
Prism– Library of Patterns for Composite Client Applications– Targets WPF Desktop and Silverlight RIA Applications– View Disovery Composition, Separated Presentation
Patterns, Module Catalog– Multi-Targeting to reuse code between Silverlight and
WPF
Download from CodePlex and send us feedback
Dave Bost
thank you!
http://davebost.comhttp://twitter.com/davebost
Q&A