Wednesday, April 13, 2011

Even simpler MVVM with Simple MVVM Toolkit v2 (think "NuGet'able, new features, new Project Templates, bug fixes and generally good and tasty stuff")

Tony Sneed's Blog - Simple Mvvm Toolkit Version 2.0: Better and Even Easier to Use

"I have just released version 2.0 of the Simple Mvvm Toolkit on CodePlex, NuGet and the Visual Studio Extensions Gallery.

Now all you have to do to get it is open Visual Studio and select Extensions Manager from the Tool menu, then search for “Simple Mvvm Toolkit” and click the Download button. Launch SimpleMvvmInstaller.exe and you’ll get the whole shebang: binaries, project and item templates, code snippets, samples and source code, copied to the SimpleMvvmToolkit directory in your Program Files folder. The ReadMe.txt file lists all the prerequisites you’ll need to install before using the toolkit. The installer will even add the toolkit to Visual Studio’s referenced assemblies, so that it appears in the list of assemblies when you show the Add Reference Dialog.

Visual Studio integration is nice, but the killer feature of v2 is the new Visual Studio project templates. You heard right, the installer not only gives you the item templates and code snippets you had in v1, but it also provides four project templates: Silverlight, Windows Phone, WPF and RIA Services. Each of these gives you a ready-made Visual Studio project that references the toolkit and includes Models, Views, ViewModels, ServiceAgents, and a ViewModelLocator. All you have to do is open the included ReadMe.txt file and follow the simple instructions, using each of the provided classes as examples. To get started just open Visual Studio, select File, New Project, then click on the Mvvm category beneath Windows (for WPF), Silverlight, or Silverlight for Windows Phone.


Codeplex - Simple MVVM Toolkit for Silverlight, WPF and Windows Phone



New Features in v2:

  • An Installer that places the binaries, templates and snippets in all the right places.
    • Copies binaries, libraries, samples and source code to one location
    • Copies Visual Studio templates and code snippets to the correction location
    • Registers the binaries so that SimpleMvvmToolkit appears in the Visual Studio Add References dialog.
  • Visual Studio project templates
    • Project templates for Silverlight, Windows Phone and WPF, which include starter Locator, Model, ViewModel, View and ServiceAgent classes.
    • A multi-project Visual Studio template that includes a Silverlight client, a Silverlight Unit Test project and a WCF RIA Services project.
  • The main sample now has Parts 2 and 3
    • Part 2 demonstrates navigation, messaging, property associations, async
    • Part 3 demonstrates using the toolkit with WCF RIA Services, including persistence with CRUD operations
  • Simplified and consolidated ViewModelLocator template which creates ViewModels on-demand.
    • This allows Views to control the ViewModel lifetime, avoiding potential memory leaks
    • Silverlight and Windows Phone apps use the same ViewModelLocator template
    • The code snippet to insert injected (for dependency injection using MEF) ViewModels is more robust
  • Improved support for unit testing (with the Silverlight Unit Testing Framework – included in the Silverlight Toolkit)
    • Includes an extension method for enqueuing conditional tasks with a timeout
  • Simpler and more robust MessageBus
    • Now uses leak-proof eventing model so that unregistering for messages is no longer required
    • ViewModelBase now includes helper methods for sending and receiving messages
  • GenericDelegateCommand supports parsing string parameters from XAML
    • Plays nicer with CommandParameter in XAML

Other Features:


A cool MVVM toolkit gets even better... I love the idea of the new Project Templates. That should help anyone new (cough... like me.. cough) up any learning curve.


Related Past Post XRef:
“Simple MVVM Toolkit for Silverlight” v1 Release

Caliburn.Micro RTW’s (Think a”Lighter/smaller/micro MVVM Framework for WPF, WP7 & Silverlight)

The MVVM Framework Tour – This time, Silverlight styling!
A MVVM framework “…three hour tour…”
A short diagramed guide of a few Model-View-* patterns
How about some free MVVM training/hands on/walkthroughs right in the VS box? “In the Box – MVVM Training” from Karl Shifflett (Oh yeah, with some WPF, Test, Moc, and Prism too)
One man’s introduction to MVVM with Visual Basic story OR zomg a MVVM article that’s not in C#!
MVVM Explained
From code-behind to MVVM in 90 Minutes - Jason Dolinger on MVVM
M-V-VM for… um… busy developers (not dummies… not dummies… okay, so I’m a dummy! ;)

No comments: