New Pluralsight Course & Prism for Windows Runtime Released!

I pleased to announce that my new Pluralsight course Building Windows Store Business Applications with Prism is now live, right on the same day that the subject – Prism for Windows Runtime – is released. How is that for timing? You can read the official word on the release from the team PM Blaine Wastell here.

I had the pleasure of working as a vendor on the Prism team (formerly known as the Kona team during development) part time. I was involved with the initial requirements definition for the project, the design of the sample applications and the reusable code libraries, and even wrote some of the code myself. So this is a topic near and dear to my heart.

If I had to sum Prism for Windows Runtime up in a short statement (or run on sentence if you are an English teacher), it would be something like this:

Prism for Windows Runtime provides samples, reusable code libraries, and documentation that will help Windows Store app developers write their apps so that they are well structured (most likely using the Model-View-ViewModel or MVVM UI separation pattern, but Prism does not mandate that), maintainable, testable, and leveraging the capabilities of the WinRT platform while following the style guidelines of Modern UI Style.

Here is a quick rundown of what the course contains. (I’ll just refer to this release as Prism here for short, but not to be confused with Prism 4 which targets WPF and Silverlight).

Module 1 – Prism Overview

In this module I talk about the overall business application context that Prism is meant to address. I clarify some of the (confusing) branding and terminology around “Windows Store apps” and I go through what is “in the box” in Prism for Windows Runtime. I do an end to end walkthrough of the main sample application of Prism – AdventureWorks Shopper – to point out where all the aspects that Prism tries to provide guidance and sample and reusable code for show up in that application. Then I close out by contrasting Prism for Windows Runtime with Prism 4 in terms of their overlap and their differences.

Module 2 – Getting Started Building WinRT Apps with Prism

In this module I talk about MVVM and the challenges of doing it with WinRT to get started. Then I cover in concept and in demo the steps involved in setting up a Prism application starting from a Windows Store Blank App project template. After that I talk about the ViewModelLocator, which is part of the reusable code of Prism for Windows Runtime, and demo how it automates the process of getting Views and ViewModels hooked up to each other dynamically at runtime. I show how the ViewModelLocator is convention based by default, and how to override those conventions so that you can provide code that locates ViewModels and constructs them based on whatever convention or process you like if you want to do things differently than the simple starter conventions of Prism.

Module 3 – Commands and Dependencies

In this module, I talk about the Command Pattern, how it is supported by the WinRT platform, and how it is used to communicate between Views and ViewModels. Then I cover the DelegateCommand class of Prism, which was ported over from Prism 4. Next I get into dependencies, define what a dependency is, how you can do manual dependency injection in Prism for dependencies that your ViewModels have (such as repositories and other client side services), as well as a quick introduction to dependency injection (or IOC) containers, and how to use a container with Prism.

Module 4 – Navigation and Application Lifecycle

In this module I cover the navigation APIs of WinRT and the styles of navigation that are common in a WinRT application. Then I show how Prism wraps those and makes it so your ViewModels can be in charge of navigation as well as be notified when their respective Page views are navigated to and from so that they can initialize their data and events appropriately and clean them up when they are going to go away because their Page has been unloaded and is going away. Then I talk about the app lifecycle of a WinRT app and how it ties in with both navigation and transient state management. I show how Prism makes it so your ViewModels can declaratively mark properties so they will be automatically persisted and restored across a suspend – terminate – launch/resume lifecycle, as well as how you can do the same thing using a Prism service (SessionStateService) in your repositories and client side services.

Module 5 – PubSubEvents and EventAggregator

This module covers how to do loosely coupled communications between ViewModels or client side services using the EventAggregator of Prism. This is a port of the EventAggregator from Prism 4 that we moved into a Portable Class Library for this release so this release version can actually be used by any .NET 4 or later, Silverlight 4 or later, Windows Phone 7.1 or later, or WinRT project. I cover the EventAggregator pattern and where it can apply in your MVVM applications, and then demonstrate using it for simple pub/sub events, using weak references, thread dispatching, and filtering.

Module 6 – Validation

One of the cool things we did in Prism for Windows Runtime is compensate for an important omission in WinRT at the current time, especially in the context of business applications that will probably involve a fair amount of data input instead of being focused mostly on content consumption (like most Windows Store app samples available). Specifically, WinRT has no support in Bindings or in the built in controls for handling validation and displaying it to the user. So this module covers how to leverage the reusable code we put together to allow your Model or ViewModel objects to declare validation rules through the standard System.ComponentModel.DataAnnotations attributes, have those evaluated whenever a property changes, and have them displayed to the user in a simple to hook up way in the UI.

Module 7 – Calling Web APIs

This module covers some fundamentals of calling Web APIs (or HTTP Services) from Windows Store apps. I do a quick intro to creating services with ASP.NET Web API, show how to use the HttpClient class to make the calls (regardless of the back end platform that is exposing Web APIs), and then get into how to secure the calls. I also cover the approach we took for doing server side validation and returning the validation errors in a standard structured manner to the client based on MVC model validation that is built in to ASP.NET Web API. I show how to use some reusable classes we implemented in Prism to consume those errors back on the client side, and get them hooked back into the client side validation mechanisms we have so that you can display the errors to the user at a field level in the same way the client side errors get displayed.

Module 8 – Leveraging WinRT Platform Features

I finish off the course with a quick tour through the implementation in the AdventureWorks Shopper application that show how to integrate and leverage platform features including Search charm, Settings charm, Flyout panels, and Live Tiles, but in a way that is properly structured to be managed and controlled by ViewModels in an MVVM application.

So I hope you will check out the course and enjoy it. If you want to read some articles that don’t go into nearly as much depth but follow a similar structure and material, you can check out my article series on Prism for Windows Runtime here. That link points to Part 1, but there are links to the other parts in the right margin. I’m still working on a few more articles for that series, so be sure to check back over the next month or so for a few more installments.

Comments are closed.