RSS
 

Archive for the ‘Silverlight’ Category

Video of my Silverlight Testing Talk Now Available

25 Jun

A little over two months ago I gave I gave a talk at the user group I manage, the North Texas Silverlight User Group on Silverlight testing.

The talk divided into two sections.  The first part was about unit testing Silverlight.  I started out with some hard to test code and worked it into easier to test code.  I also demonstrated the Silverlight unit test runner. The second part was about automating functional testing using Telerik’s WebUI Test Studio .  Everyone was impressed by Telerik’s tooling and their automated testing experience.

Shawn Weisfeld, one of our most stalwart community members, was there and recorded the talk and has made it available on his recently launched media site usergroup.tv.  If you are interested you can check it out here.   This was one of my favorite meetings we’ve had because people really got involved in the discussion of testing.  FYI this lead to some long pauses in the video, so be ready to skip past those.

 
 

From PRISM to Caliburn Micro: Event Aggregation

08 Mar

My team is in the process of transitioning our Silverlight development from Prism to Caliburn Micro.  I’ve had questions about how common PRISM scenarios map to Caliburn Micro.

One feature found in most MVVM frameworks is an Event Aggregator.  Martin Fowler describes this in his “Further Patterns of Enterprise Architecture”.  According to Fowler, the purpose of the Event Aggregator is to simplify event registration by “channeling events from multiple objects into a single object”.

Event Aggregators are most relevant to rich client development, where multiple bits of a composite interface need to share common state.  For example, a toolbar, a status bar, a screen, and a notification icon may all need to be synchronized with some common theme that cross cuts the view model approach to state management.  Event Aggregators simplify registration and publication of events between objects to some subset of the M * N unique registrations that would be required otherwise.

Event Aggregation in PRISM

In Prism, an event is declare by inheriting from a CompositePresentationEvent<T> where T is the message payload.

public class FooEvent : CompositePresentationEvent<FooEventArgs> { }

 

The actual aggregator is called an EventAggregator.  It has a single method, GetEvent<T> which gets an instance of the event type T.

Firing an aggregate event from PRISM is simple.

myEventAggregator.GetEvent<FooEvent>().Publish(fooEventArgs);
 

Subscribing is another matter entirely.  Subscribing has up to five parameters including whether to hold a strong or weak reference to the subscriber, which thread to call subscribers on, a filter to determine if the subscriber gets the event, and the delegate to invoke.

The defaults work for most situations and the overloads may create problems. Supporting both strong and weak referencing can lead to confusion.

myEventAggregator.GetEvent<FooEvent>().Subscribe(OnFoo);
 

Event Aggregation in Caliburn Micro

Event Aggregation in Caliburn Micro is simple.  In Caliburn Micro, events are plain old CLR objects (poCo).  The event argument payload, if needed, is declared in the event as one or more simple properties.

public class FooEvent { public string myProp; }

 

To subscribe events of interest, subscribers implements IHandle<T> where T is the event of interest.  The actual subscription wiring occurs by having interest subscribers pass themselves as an argument to the event aggregator’s subscribe method:

    public class Foo : IHandle<FooEvent>
    {
        private IEventAggregator myEventAggregator;

        public Foo()
        {
            myEventAggregator.Subscribe(this);
        }


        public void Handle(FooEvent message)
        {
          
        }
    }
 

This IHandle<T> approach makes explicit and clear at a glance the relationship between interested subscribers and their subscribed events.

Publication is very straightforward:

myEventAggregator.Publish<FooEvent>(new FooEvent());
 

Caliburn Micro’s publish model isn’t as powerful as its PRISM counter part.  Yet it prevents you from shooting yourself in the foot with good, opinionated defaults;  It holds weak references in the event aggregator and  executes events on the UI thread.

While some PRISM event scenarios cannot be implemented using the event aggregator in Caliburn Micro, this lack of choice isn’t a deficit.  It welcomes us all into the “pit of success.”

 
 

MVVM Smack Down Videos Now Online

12 Dec

In November myself and some friends presented an “MVVM Smack Down” at the North Texas Silverlight User Group.  We did a head to head comparison of Prism 4, The MVVM Light toolkit, Caliburn Micro, and Jounce.  It was presented with a bit of friendly banter and was meant really to enlighten, compare, and contrast more than to judge the various frameworks.

The videos are available here:

 

For many of us this was our first technical presentation in front of a public audience.  There was areas for improvement and I didn’t have as much time as I would have liked, but I think all things considered it went fairly well.

I also wanted to give a special thanks to Shawn Weisfeld for recording the sessions for INETA (and all the sessions he records).

 
 

Code and Slides from Introduction to Silverlight Talk

11 Dec

This morning I gave a talk called “Introduction to Silverlight” at the North Texas PC User Group.

WhatIsSilverlight

 

I had a great time giving this talk. Silverlight is the most fun technology Microsoft has created (Well, after the Xbox of course).  I enjoy having the opportunity to share that fun with others.

Get the codes and slides here: Intro to Silverlight.12.11.2010.zip

 
 

Windows 7 Phone Launch Event

10 Oct

On October 20th and 21st I’m pleased to announce I’ll be assisting my fellow developers at the sold out Microsoft Windows Phone 7 Jump Start event.  I really love taking part in opportunities like this because I find teaching and mentoring to be a most wonderful experience.  There’s something wonderful about the moment when people really grasp a new concept. Windows Phone 7 is a potential game changer.

For developers, two of the most developer friendly technologies from Microsoft, Silverlight and XNA, are baked in and optimized for.  Also, the Visual Studio tooling for Windows Phone 7 development is a joy to work with.  While there are new concepts to understand such as tombstoning, live tiles, notifications,etc, current investments in Silverlight development pay off big on this platform.  Speaking of Silverlight, is anyone else impressed that Microsoft elected to use Silverlight for their Windows Phone 7 landing page?

 

Founding of The North Texas Silverlight User Group

08 Oct

header

I’ve been meaning to post this for awhile.

A couple of guys at Sogeti and Broadlane (including yours truly) have formed the North Texas Silverlight user group!  The response has been amazing.  In less than three weeks we have gone from 0 to almost 40 attendees for the first meeting.  We’ve also managed to wrangle two fantastic speakers, Caleb Jenkins and Teresa Burger for our first meeting.  Caleb will be presenting on Windows Phone 7 “For World Domination” as the primary speaker for the first meeting.   Knowing Caleb it’s bound to entertain.  Teresa will be doing our first blend segment or “Blendlet” on grid splitters and handles in Microsoft Expression Blend.

Forming this group was in one sense much easier than I thought and in another much harder.  What was easier than I thought is how willing people and companies are to help out.  We needed money and our sponsors graciously agreed.  We needed space at the last minute and Chris Koenig and Microsoft stepped up to the plate.  We needed exposure and Teresa, Caleb, Shawn Weisfeld , and many others in the community retweeted and blogged on our behalf.  The goodwill from everyone I interacted with during this process was heart warming.

The harder parts have been the little things that we as user group goers barely notice when done right.  Getting food for 40, a space, security, swag, etc. is a more involved process that I would have thought. I bet going forward we’ll get it down to a science though.

Wish us luck and we hope to see you there!  For more information visit the group at www.ntsilverlight.com.