Title: Composite User Interface Application Block
1Composite User Interface Application Block
- Peter Provost
- Development Lead patterns practices
- peter.provost_at_microsoft.com
- http//www.peterprovost.org/
2Application Scenarios
- Highly intensive, task oriented UIs
- Client Integration scenarios
- Call Center
- e.g. Microsoft Customer Care Framework
- Product Configurators
- Financial or Manufacturing Desktops
- Tellers
- The scenarios cover a wide range
- Transactional or data analysis
- All new or integration with existing apps
- Standalone client or integrate into other
applications
3What Is A Composite Smart Client?
Smart Client Module
Billing
Smart Client Module
Inventory
Composite Solution
Host Apps
Smart Client Module
CRM
- Compose solution from discrete functional pieces
- Environment provides basic smart client services
capabilities - Reduces dev cost, can realize smart client
benefits more easily - Flexible and agile NM partsshells, dynamic
composition
4Composite UI A patterns view
Shell Services
Workspaces
Strategy presenters for UI
UI Extension Sites
View
View
Command
Commands
MVC
Activation
SPInfo
Controller
Presenter
MVP
Pub/Sub
Core Services
Event Broker
WorkItem
State
Model
Model
State Persistence
Blackboard
CAB Application
Workflow
Use Case Controller
Crypto
Extension
Instrum
Lifetime Container
Service Locator
ObjectBuilder
Module Loading
Builder
Enumerator
Loader
AuthN
Factory
Injection types 2..6 ?
Plugins
5How Does It Work?
Shell
UI Extension Site
View
UI Extension Site
View
Work Item Shared State Shared Events
Element
Element
Module
Module Catalog
6Building a composite application How should I
organize my code to facilitate composition?
- Build the views as independent units with
controllers or presenters - Prepare to share model state
- Share infrastructure services
- Encapsulate use cases to facilitate reuse
- Reduce the number and complexity of dependencies
- Use events, services, and bind to interfaces as
much as possible
A Work Item
Smart Part A
Smart Part B
Controller A
Controller B
7Developing a Composite User ExperienceHow does
the CAB architecture facilitate UX composition?
- SmartParts are controls Workspaces show them in
a specific visual frame - Shell developer builds workspaces. Controls can
be agnostic to workspaces - UI Elements can be added with common approach to
specific sites - Can centralize how/when UI gets affected by a use
case - Commands
- Connecting actionable set of UI elements to a
business logic callback
Application Shell
Windows Workspace
UI Extension Site
Tab Workspace
Element1
UI Extension Site
Element2
A Work Item
View A
View B
Command
Command
Controller A
Controller B
UI Init
8Event Broker Pub-Sub in your app
Subscribers
Publishers
.NET method with attribute
.NET Event with Attribute
1
EventPublication(topic//Customer/Changed) eve
nt EventHandlerltCustArgsgt CustomerIdChanged //fi
re like a normal .NET event CustomerIdChanged(this
, new CustArgs() )
EventSubscription(topic//Customer/Changed,
ThreadOption.Background) Public void
CustomerChanged(object sender, CustArgs args)
//go call some web services or something
long-running
EventSubscription(topic//Customer/Changed) Pu
blic void CustomerChanged(object sender, CustArgs
args) MessageBox.Show(args.CustomerId,new
customer!)
- Publishers and Subscribers agree on
- Topic (identified by a URI)
- Message (in case a special EventArgs is required)
- Publishers set scope of event
- Subscribers have control over the thread in which
they process the call - Background (For long-running work)
- UI Thread (to update UI controls on appropriate
thread) - Publisher (on same thread as publisher)
9Commands
- Commands help you react to UI events in a shell
agnostic way - One Command can map to multiple UI Elements
- Commands from parent WorkItems can be used but
not removed
Application Shell
Control1
Adapter
Control 2
Adapter
A Work Item
A Command
Controller A
10WorkItem Extensions
- Example
- How do I add new views of my customer data to the
right workitems w/out changing their code? - WorkItem Extensions allows you to affect
WorkItems without changing it - Which one(s)? Identified by type implemented
- Can be deployed in a separate module, discovered
at load time, or registered programatically
WorkItemExtension(typeof(MyWorkItem)) public
class MyExtension WorkItemExtension
protected override OnActivate()
11Roadmap
- CAB Final release targeted for Nov 7
- CAB included as foundation for Smart Client
Baseline Architecture Toolkit (SC-BAT) - Smart Client Toolkit will also include
integration with Entlib, Offline, and project
templates - Future
- UIP Using WWF, no date yet
- Using Avalon CAB it is possible
- Layered design Winforms interop
- No public sample before our release
12Shameless Plug
- patterns practices is hiring
- See me after the talk or e-mailDarrel Snow
dsnow_at_microsoft.com
13Please Fill Out Your Evals
- http//eval.pacwest.ms/
- Thanks!