PRISM, MEF, and MVVM Part 3 of 3: Dynamic MEF Modules in PRISM

Series recap: PRISM, MEF, and MVVM Part 1 of 3: Unity Glue PRISM, MEF, and MVVM Part 2 of 3: Making PRISM MEF Friendly PRISM, MEF, and MVVM Part 3 of 3: Dynamic MEF Modules in PRISM In the final part of this series, I will show a dynamically loaded module (using PRISM) that takes…

PRISM, MEF, and MVVM Part 2 of 3: Making PRISM MEF Friendly

In the first part of this series, we explored using the Unity container to bind the view model to the view. The next logical step is to explore how to use MEF. PRISM provides several useful mechanisms that relate directly to views and modules, such as the region manager and the module manager. This allows…

Receiving notifications when garbage collections occur

While creating the 3rd Edition of my CLR via C# book (http://www.amazon.com/CLR-via-C-Third-Pro-Developer/dp/0735627045/ref=dp_ob_title_bk), I came up with a cool little class that will raise an event after a collection of Generation 0 or Generation 2 occurs. Here is the code for the class: public static class GCNotification { private static Action<Int32> s_gcDone = null; // The…

PRISM, MEF and MVVM Part 1 of 3: Unity Glue

PRISM, also known as Composite WPF, has established itself as a very popular framework for building modular, scalable Silverlight applications. A newer contender, the Managed Extensibility Framework (MEF), has also grown in popularity. In fact, these two frameworks have left people scratching their heads wondering which one to use, when, how, and why. Download the…

Silverlight’s Big Image Problem (and What You Can Do About It)

Quick: Can you spot the problem with these three lines of code? BitmapImage bi = new BitmapImage(); bi.SetSource(stream); TheImage.Source = bi; These statements create an image from a stream of PNG or JPG image bits and display the image by assigning it to a XAML Image object named TheImage. It’s boilerplate code used to display images read…

Dispatching in Silverlight

Anyone who has been building Silverlight and/or WPF applications for some time understands that there is a single UI thread that has special access requirements if you are going to be updating elements. In other words, if I spin off a new thread, I cannot arbitrarily impact the UI unless I get back to the…

Silverlight 4’s New COM Automation Support

One of Silverlight 4’s most compelling new features is support for out-of-browser applications with elevated permissions. An app running with elevated permissions can perform actions that a normal sandboxed application can not. For example, it can access the local file system, and on Windows boxes, it can interact with COM automation servers. This latter feature—also…

Getting Rid of the Intel Graphics Media Accelerator Tray Crapware

This weekend I purchased a Samsung N110 netbook and slapped Windows 7 on that thing as fast as I could. The install was beautiful and recognized all the devices on the machine. Giving Windows Update a whirl, I see there are updates for the LAN hardware and the Intel Mobile Graphics 945 Express Chipset so…

Unit Tests for ViewModels AND Views in Silverlight

Over the past few posts I’ve been exploring models for modularized Silverlight applications that follow the MVVM pattern (using Prism/CAL). In this post, I’d like to cover unit testing, and writing appropriate tests not just for the view model, but the view itself. Before we continue, I’m going to assume you’ve read: Dynamic Module Loading…

Simplifying Asynchronous Calls in Silverlight using Action

This post explores a way to encapsulate web service calls from Silverlight in a way that is easy to use and understand. As anyone who works with Silverlight knows, Silverlight forces web service calls to be asynchronous. There is a good reason for this, which I won’t get into with this post. What I would…

How I Use OneNote

When I posted Tools We Use, there were several comments, as well as many emails asking me how I used OneNote for debugging and development. Yes, I was the one who wrote “The greatest piece of software ever written. I’ve done more debugging and development with OneNote than anything else.” Having been a proponent for…

Host WCF as Windows Service without Installing

I am working on a project that involves a centralized UI that then coordinates with agents to send out instructions. The agents will be WCF endpoints and to ease deployment/minimize the install footprint, they will install as windows services with a nice installer rather than hanging onto an IIS webspace directly. In this post I…