Soft serve prism

19
Presenter: Sergiy Beslik Prism - Composite Application Guidance for WPF and Silverlight

Transcript of Soft serve prism

Page 1: Soft serve prism

Presenter: Sergiy Beslik

Prism - Composite Application Guidance for WPF and Silverlight

Page 2: Soft serve prism

What is Composite Application?

Composite Application consists of loosely coupled modules that can be developed independently, discovered at runtime and work together.

Page 3: Soft serve prism

What is Prism?

Prism is a set of guidance designed to help building composite UI applications with WPF and Silverlight.

Application

Client

Server

Database

Prism

Page 4: Soft serve prism

What is Prism?

Library Reference Implementation Guidelines Quick-Starts

Page 5: Soft serve prism

Prism Core Concepts

Modules UI Composition Dependency Injection Events and Commands Separated Presentation

Patterns Multi-targeting

Page 6: Soft serve prism

Modules

Unit of development– Modules can be developed and tested independently by

different teams. Unit of deployment

– Modules can be loaded on demand, minimizing application start-up time.

– Modules can be added or changed without re-building the whole application.

Page 7: Soft serve prism

Bootstrapper

Bootstrapper

Module A

public class ModuleA : IModule { public void Initialize() {

Page 8: Soft serve prism

UI Composition

Views from multiple modules are displayed at run time in specific locations within the application's UI.

<TabControl RegionManager.RegionName = “MainContentRegion” />

Module A

<ItemsControl RegionManager.RegionName= “NavigationRegion">

Module B

Page 9: Soft serve prism

View Discovery vs. View Injection

Views can be instantiated automatically when region is displayed, or explicitly injected into region.

Page 10: Soft serve prism

Dependency Injection

ClassA

ObjectBuilder

ClassB

«interface»IClassB

«creates»

«uses»

«creates»

ClassA ServiceLocator

ClassB

«interface»IClassB

«uses»

«creates»

Dependency Injection Pattern Service Locator Pattern

Page 11: Soft serve prism

Events and Commands

Delegate Command– Implements delegate-based

Command pattern Composite Command

– Implements multiple handlers command routing

Event Aggregator– Implements publishing and

subscribing to loosely coupled events

Page 12: Soft serve prism

Event Aggregator

Event Aggregator is a mediator service that allows decoupling of publishers and subscribers.

Module A

eventAggregator.GetEvent<MyEvent>().Publish(eventArgs)

eventAggregator.GetEvent<MyEvent>().Subscribe(MyEventHandler, ThreadOption.UIThread, false, MyEventFilter);

Module B

Page 13: Soft serve prism

Separate Presentation Patterns

Model-View-Controller (MVC) Model-View-Presenter (MVP) Presentation Model (PM) Model-View-ViewModel (MVVM)

View Controller

Model

Model-View-Controller

View Presenter

Model

Model-View-Presenter

Page 14: Soft serve prism

Model-View-ViewModel Pattern

Vie

w

Vie

wM

odel

Mod

el

Data binding

ICommand

Read

Write

Update events

Page 15: Soft serve prism

Prism Reference Implementation

Demo…

Page 16: Soft serve prism

Prism Releases

Prism 1.0 – WPF, July 2008 Prism 2.0 – WPF & Silverlight 2.0, Feb 2009 Prism 2.1 – WPF & Silverlight 3.0, Oct 2009 Prism 2.2 – WPF & Silverlight 4.0, May 2010 Prism 4.0 – WPF & Silverlight 4.0, beta version is

available

Page 17: Soft serve prism

What’s new in Prism 4.0

WPF 4.0 Support More ViewModel Pattern Guidance Managed Extensibility Framework (MEF) Support Guidance For Out of Browser Applications Application Structure Patterns & Navigation

Page 18: Soft serve prism

Useful links

MSDN Magazine article “Patterns For Building Composite Applications With WPF”: http://msdn.microsoft.com/en-us/magazine/cc785479.aspx

MSDN Magazine article “WPF Apps with the Model-View-ViewModel Design Pattern”: http://msdn.microsoft.com/en-us/magazine/dd419663.aspx

PowerPoint presentation and video from Patterns & Practices Symposium in Kiev, September 2010: http://www.techdays.in.ua/videos/2897.html

Download latest version of Prism: http://compositewpf.codeplex.com/releases/view/46046

Page 19: Soft serve prism

Thank You!

Copyright © 2010 SoftServe, Inc.

Contacts

Europe Headquarters 52 V. Velykoho Str.Lviv 79053, Ukraine

Tel: +380-32-240-9090Fax: +380-32-240-9080

E-mail: [email protected]: www.softserveinc.com

US Headquarters12800 University Drive, Suite 250Fort Myers, FL 33907, USA

Tel: 239-690-3111 Fax: 239-690-3116