Composite Application Guidance for WPF and Silverlight (AKA Prism 2 )

Similar documents
AR.04 Composite Application Guidance for WPF (aka Prism ) Brian Noyes IDesign Inc (

Prism Composite Application Guidance

Prism Composite Application Guidance

Building Loosely Coupled XAML Client Apps with Prism

Building Extensible XAML Client Apps

Build Testable Client and Service Applications

Thinking and Processing in Parallel Wrap Your Head Around WF 4.0 Concurrency. Brian Noyes IDesign Inc (

Drive Application Behavior with Application and User Configuration Settings Brian Noyes IDesign Inc (

Build Loosely Coupled Silverlight Business Applications

Building Extensible XAML Client Apps

LVL08 Black Belt Silverlight Business Data Validation

VSC01 Securing WPF Client Applications

Drive Application Behavior with Application and User Configuration Settings. Brian Noyes IDesign Inc (

APP301: Implement a Data Access Layer with Enterprise Library

Windows Presentation Foundation In Windows Forms And Vice Versa

VWC02 Build N-Tier Silverlight Data Applications Easily with WCF RIA Services

VS10 WCF of Many Flavors When do I use which?

Blissful Separation of Concerns with Model-View-ViewModel (MVVM)

NET237: Deploying Smart Client Apps with ClickOnce

Learn to Behave Extend Your XAML with Behaviors

Smart Client Offline Data Caching and Synchronization

Data Binding with Windows Forms 2.0

WCF RIA Services. About Brian 8/10/2011. Brian Noyes Chief Architect IDesign Inc. (

Build Custom Data Bound Objects and Collections

Microsoft TechEd US, Europe, Malaysia, Visual Studio Connections, DevTeach, INETA Speakers Bureau, MSDN Webcasts

VS08 This One Goes to Going Parallel with PFX, PLINQ, TPL and Async Keywords

Tackle Complex Data Binding in WinForms 2.0

NE.15 Data Binding In Windows Presentation Foundation

Data Binding in ASP.NET 2.0

Introduction to.net Deployment. Brian Noyes IDesign, Inc. (

KnOwledge

Build Process Driven Applications with WF

Build Better WPF & Silverlight applications using Prism v2

Implementing MVVM in Real World ArcGIS Server Silverlight Applications. Brandon Copeland LJA Engineering, Inc.

Extending ASP.NET. Brian Noyes Principal Software Architect IDesign, Inc. ( (

Practical WPF. Learn by Working Professionals

Learn.Net WPF with Prism & Multithreading. This syllabus is cover WPF with Prism 4.0 & multithreading

Microsoft Partner Day. Introduction to SharePoint for.net Developer

Application Architecture Guide. Don Smith Community Liaison Microsoft patterns & practices

Telerik Sales Dashboard: an Extensible Cross-Platform Application

Software Design Patterns. Background 1. Background 2. Jonathan I. Maletic, Ph.D.

Smart Client Offline Data Caching and Synchronization

From Code To Architecture

WPF. Source Module 01: Lesson1

Cross-Platform Mobile Platforms and Xamarin. Presented by Mir Majeed

Migrate Your Skills to Microsoft.NET Framework 2.0 and 3.0 using Visual Studio 2005 (C#)

OO Frameworks. Introduction. Using Frameworks

Building Next Generation GUIs using Microsoft Expression Interactive Designer

Modellistica Medica. Maria Grazia Pia, INFN Genova. Scuola di Specializzazione in Fisica Sanitaria Genova Anno Accademico

Socket attaches to a Ratchet. 2) Bridge Decouple an abstraction from its implementation so that the two can vary independently.

There is no such thing as a microservice!

10262A VB: Developing Windows Applications with Microsoft Visual Studio 2010

Top 7 Lessons From My First Big Silverlight Project

Configuring and Customizing the ArcGIS Viewer for Silverlight. Katy Dalton

2A The CA Plex.NET Client Generator. Rob Layzell CA Technologies

Microsoft Dynamics Road To Repeatability Technical Deep Dive Server Extensibility in Microsoft Dynamics NAV. Vjekoslav Babić, MVP

Visual Studio 2015: Windows Presentation Foundation (using VB.NET Language) Training Course Outline

Using JBI for Service-Oriented Integration (SOI)

SHAREPOINT 2013 DEVELOPMENT

Upgrading to Windows Server 2008

ArcGIS Viewer for Silverlight Advanced Topics

Windows Presentation Foundation. Jim Fawcett CSE687 Object Oriented Design Spring 2018

JAVA COURSES. Empowering Innovation. DN InfoTech Pvt. Ltd. H-151, Sector 63, Noida, UP

Architecting ios Project. Massimo Oliviero

Pro XAML with C# From Design to Deployment on WPF, Windows Store, and Windows Phone. Buddy James. Lori Lalonde

Windows Presentation Foundation (WPF)

DEVELOPING WEB APPLICATIONS WITH MICROSOFT VISUAL STUDIO Course: 10264A; Duration: 5 Days; Instructor-led

PROGRAMMING WITH THE MICROSOFT.NET FRAMEWORK USING MICROSOFT VISUAL STUDIO 2005 Course No. MS4995A 5 Day PREREQUISITES COURSE OUTLINE

The Strategy Pattern Design Principle: Design Principle: Design Principle:

SharePoint 2010 Developer Core Skills Course Length: 5 days Price: $3,000

Mike Ormond Developer and Platform Group, Microsoft Ltd

SCS (Stocker Controller System)

Events & Extensions & Powershell, Oh My!!

--Microsoft-- --Windows Phone--

Building a mobile enterprise application with Xamarin.Forms, Docker, MVVM and.net Core. Gill

Test Your XAML-based Windows Store Apps with Visual Studio 2013 Benjamin Day

04 Sharing Code Between Windows 8 and Windows Phone 8 in Visual Studio. Ben Riga

Extensibility, Componentization, and Infrastructure

Managing Installations and Provisioning of OSGi Applications. Carsten Ziegeler

Simple AngularJS thanks to Best Practices

WPF and MVVM Study Guides

CA Plex Status and Plans

1 Software Architecture

20483BC: Programming in C#

Topics in Object-Oriented Design Patterns

1A Windows Presentation Foundation Explained. Rob Layzell CA Technologies

Design Patterns. Manuel Mastrofini. Systems Engineering and Web Services. University of Rome Tor Vergata June 2011

Microsoft Visual C# Step by Step. John Sharp

Microsoft. Inside Microsoft. SharePoint Ted Pattison. Andrew Connell. Scot Hillier. David Mann

Module 1. An Introduction to C# Module 2. Classes and Objects. Vasundhara Sector 14-A, Plot No , Near Vaishali Metro Station,Ghaziabad

ArcGIS Pro SDK for.net Intro and Pro Add-in Programming Patterns. Wolfgang Kaiser

Design Pattern What is a Design Pattern? Design Pattern Elements. Almas Ansari Page 1

APACHE SLING & FRIENDS TECH MEETUP BERLIN, SEPTEMBER APACHE JACKRABBIT: BASIC CONCEPTS Christian Riemath, Igor Sechyn

Design Patterns Reid Holmes

Microsoft.CerTkiller v by.SANDRA.65q

STARCOUNTER. Technical Overview

RESTful Web service composition with BPEL for REST

Enterprise Library 5.0: The New Stuff. Ade Miller Microsoft patterns & practices

Windows Presentation Foundation Programming Using C#

ArcGIS Pro Extensibility - Building and Deploying Addins with the new DotNet SDK

Transcription:

Composite Application Guidance for WPF and Silverlight (AKA Prism 2 ) Brian Noyes www.idesign.net About Brian Chief Architect, IDesign Inc. (www.idesign.net) Microsoft Regional Director / MVP Publishing Developing Applications with Windows Workflow Foundation, LiveLessons training DVD, June 2007. Smart Client Deployment with ClickOnce, Addison Wesley, January 2007 Data Binding in Windows Forms 2.0, Addison Wesley, January 2006 MSDN Magazine, MSDN Online, CoDe Magazine, The Server Side.NET, asp.netpro, Visual Studio Magazine Speaking Microsoft TechEd US, Europe, Malaysia, Visual Studio Connections, DevTeach, INETA Speakers Bureau, MSDN Webcasts Participates in Microsoft Design Reviews E-mail: brian.noyes@idesign.net Blog: http://briannoyes.net 1

Agenda Composite Application Guidance Overview Application Architecture CAL Features Regions Modules Commands Events Patterns Composite Application Guidance Developed by Microsoft patterns and practices Designed as a successor to CAB/SCSF for WPF Ground up redesign Leverage the things that are unique about WPF Same motivations / fundamental requirements as CAB Use lessons learned from CAB Lighter weight / less intrusive Stronger typing Don t lock into a single container model Many others 2

Composite Application Guidance Consists of: Composite Application Libraries (CAL) Stock Trader Reference Implementation (RI) Quickstarts Documentation How-Tos Published Spikes Current Version: 2.0 Why Composites? Loose coupling Separation of concerns Agility Maintainability Extensibility 3

Agenda Composite Application Guidance Overview Application Architecture CAL Features Regions Modules Commands Events Patterns Composite WPF App Parts Container Bootstrapper Shell Modules Views Services 4

Dependency Injection Also known as Inversion of Control (IoC) or DI for short Pattern for indirect construction of objects Delegate responsibility for construction of objects to a Container Container constructs objects and injects their dependencies Unity Application Block Dependency Injection Container Default for Prism (can use others though) Main functions: Register Tell Unity it is responsible for a type or object Resolve Obtain an object reference from the container BuildUp Inject dependencies in an existing object Configure Register based on configuration info Many overloads / variants Generic and non-generic versions 5

Bootstrapper Startup code for your application Alternative to putting everything in the Main() method Well defined intialization point in your application Not required, but recommended Bootstrapping Process 6

Shell Main window of the application Could be more than one Presented at startup (typically, could be minimized to System Tray) Root element for the whole UI Even modular views that know nothing about the shell Typically knows nothing about the views that it is composed of Just provides a shell to contain them, thus the name May define regions for dynamic plug in of views May explicitly load views into containers in the UI Shell Implementation Just a normal WPF Window Defines the overall layout for the application May contribute styles and templates that flow down to child view through resources Take Window1.xaml created by VS2008 and rename it to Shell.xaml Do WPF stuff from there Add regions for views to be added by modules 7

Views Composite parts (Legos) of your UI Used to decompose your window from one big monolithic blob into a bunch of semi-autonomous parts Can be defined as: User control Custom control WPF Data Template XAML Resource Dynamically constructed UI Element tree Ultimately in WPF: A UIElement with some backing logic Views 8

Composite View View that contains other views Child views may be added By composite view statically XAML declaration Programmatic addition Through regions within the composite view Composite view generally responsible for composing itself out of child views May have some content of its own as well Services Common abstraction in composites Does not (necessarily) mean Web or WCF services Application (in-proc) service might be point of encapsulation for the proxy that calls an external service Provide shared services across the application Modules and shell Typically singleton instance model Container provides the glue 9

Services CAL Provided: Logging Region Manager Event Aggregator Module Catalog Custom Customer service Agenda Composite Application Guidance Overview Application Architecture CAL Features Modules Regions Commands Events Patterns 10

Modules Unit of composition for the application As opposed to views as the unit of composition for the UI Modules contain the artifacts for a portion of your application Self-contained Decoupled Reusable Typically defined as a Visual Studio project / assembly Can have more than one module per assembly Avoid Modules Main purpose: Initialize the objects in the module Like a Main() method for a library Known entry point in the module Initializes Container types Views Regions Services Controllers Etc 11

Module Loading CAL supports: Statically Dynamically Directory scan Config On-demand Modules can be dependent on other modules Need to resolve load order in that case Agenda Composite Application Guidance Overview Application Architecture CAL Features Modules Regions Commands Events Patterns 12

Regions Placeholder (named location) for view containment Views dynamically added by app/module code Prism 2 supports two approaches: View Discovery View Injection Can be defined by the shell or a composite view Shell almost always Composite View less often Regions 13

RI Regions Region Manager CAL Service Registration point for named regions Modules get a region references from the region manager Use the region to add their views 14

Agenda Composite Application Guidance Overview Application Architecture CAL Features Modules Regions Commands Events Patterns Command Pattern 15

WPF Routed Command Limitations Tied to the visual tree Use routed events as the command dispatch mechanism Bubbling and tunneling Means no way to put the command logic outside the view without a handoff from the view Tied to the focused element Can get in focus hell if handler is not up the element tree from the invoker Single handler invoked First-in wins during tunneling and bubbling process No multi-dispatch Bottom Line: Insufficient for composites CAL Commands Based on WPF ICommand interface Gets the handling out of the visual tree Handlers can be presenters or controllers Breaks the dependency on focus Allows multiple targets 16

Composite Commands Submit All Composite Command OrderDetails OrderDetails OrderDetails Submit Submit Submit Delegate Commands Agenda Composite Application Guidance Overview Application Architecture CAL Features Modules Regions Commands Events Patterns 17

WPF Routed Events New feature of WPF More than just.net events Tied to the visual tree Only allows elements within the visual tree to handle an event raised by another element in the visual tree Supported routing schemes: Bubbling Tunneling Direct Bottom Line: Insufficient for composites CAL Events Based on pub/sub pattern Uses an event aggregator service Get event from aggregator Subscribe or publish Decouples publishers and subscribers Type Lifetime Handles threading issues Provides filtering capability Allows communications between loosely coupled, non-visual parts Presenters and controllers 18

Event Aggregation EventAggregator Service OrderReceived Receives Publishes OrderModule Subscribes OrderManager OrderService OrderListPresenter Agenda Composite Application Guidance Overview Application Architecture CAL Features Modules Regions Commands Events Patterns 19

Model View Presenter Variants Presentation Model Also known as Model-View-ViewModel 20

Service/Dependency Injection Container 4/22/2009 Patterns in CAL Adapter Composite View View View Host Application Shell Regions Region Modules Modules Separated Presentation Command Presenter Model Shell Presenter Inversion of Control Service Locator Plug In Loading Services Separated Interface Event Aggregator Core Services Module Proffered Services Resources Build Composite WPF Applications, Brian Noyes, CoDe Magazine, Nov/Dec 2008, http://www.code-magazine.com. Patterns for Building Composite Applications with WPF, Glenn Block, MSDN Magazine, Sep 2008, http://msdn.microsoft.com/en-us/magazine/cc785479.aspx. Understanding Routed Events and Commands, Brian Noyes, MSDN Magazine, September 2008, http://msdn.microsoft.com/en-us/magazine/cc785480.aspx..net Rocks! Interview: http://www.dotnetrocks.com/default.aspx?shownum=374 Prism podcast, Brian Noyes: http://pixel8.infragistics.com/shows/prism.aspx. DNRTV: http://www.dnrtv.com/default.aspx?shownum=124, http://www.dnrtv.com/default.aspx?shownum=132 21