I’m pleased to announce the official release of Jounce 2.0 for Silverlight 5. There are quite a number of new features available that I’ll review in this post. Most significantly, of course, the code base has been updated specifically to target Silverlight 5. A number of bug fixes, feature requests, and Silverlight 5 features have been added. The DLL for Jounce is still just under 100 KB for release so it remains nimble and lightweight.
There are two ways you can install the latest. Zip over to Jounce at CodePlex to download the binaries and/or the full source. Or, jump into NuGet and install the Jounce package. The package is set up to wire in a default application. To get this functionality, follow these simple steps:
- Create a new Silverlight application. I recommend the basic “Silverlight Application” template as I haven’t tested with any others, and it doesn’t matter if you host it in a web site and/or choose to use WCF RIA services.
- Delete the
MainPage.xamlfiles. Trust me on this one.
- Jump into the package manager console and type
- Hold down CTRL and press F5 and you should see a welcome message. That’s it. You are ready to write your Jounce application.
The code base is now CLS compliant.
The application service used to wire Jounce now exposes some configuration properties. You can use this to have Jounce ignore unhandled exceptions (by default, it will intercept these and publish them as a message instead) and also to set the debug level. These used to be parsed from the parameters from the
object tag but obviously this did not make sense for OOB applications.
When dynamically loading XAP files (i.e. extension or plugin modules) you can specify a callback that Jounce will call to report progress. This allows you to have more control over the extension points and display a progress message to the end user for example.
The processing of the XAP file URL was updated to allow query strings. This is a common method to dynamically serve up XAP files and/or to manage updates for OOB applications. Jounce used to choke on this but the code was updated to gracefully handle this when you specify the URL to the XAP to download.
You no longer have to derive your view model from the
BaseViewModel class. The only requirement for the framework to work is for you to implement the
IViewModel interface. This will help developers who wanted to provide their own base class services and found it difficult due to the face you cannot derive from more than one base class (hey, I managed to sneak in a basic interview question).
You can specify an option using metadata to automatically call
Deactivate on your view model when the corresponding view is unloaded (i.e. if the
Unloaded event fires). This allows you to perform clean up automatically when the view goes out of scope.
You can now map a view to a view model in three ways. You can export a
ViewModelRoute, you can fluently bind them using a new interface, and you can specify the view model in XAML. The new
MapToViewModel custom markup extension allows you to specify the view model name, whether you want a shared or non-shared copy, and whether the
Deactivate method should be called when the view is unloaded. This makes it possible to use templates that bind to new instances of view models.
There is additional support for the OOB windows. You can append parameters to the navigation payload or use some fluent extension methods to specify the title and size of a view and have it loaded into a separate window instead of a region. You can also raise events with a title to set the title of the HTML page (in browser) or OOB application (out of browser). To further support OOB, there are additional attributes you can query on the base view model to determine if the application is running out of browser and whether or not it is installed on the user machine.
There is a new class available called
CustomType that allows you to construct a dynamic type that is bindable to view models. For example, you might parse a JSON object and use this type to build up the object. It features methods to add new properties and fetch them and will also act as a dictionary with an indexer. It uses an underlying helper class that takes advantage of Silverlight 5’s
ICustomTypeProvider. You can use the source as a template to build your own custom types (or derive from it instead).
I will update documentation and examples as I can moving forward. My book, Designing Silverlight Business Applications, has many examples of building applications using Jounce including WCF RIA. Thanks everyone for their patience and support of this project!