DevForce 2010 Resource Center » Code samples » Additional code samples » MVVM » Intersoft ClientUI MVVM with DevForce (Silverlight) (WPF)

Intersoft ClientUI MVVM with DevForce (Silverlight) (WPF)

Last modified on April 19, 2013 15:03

04.18.2013 Update
The latest suite of Intersoft WebUI Studio 2012 R2 ships with DevForce 2010 (version In the next release, Intersoft will include full support for DevForce 2012. However, they've made the new support assemblies available now so you can start using them with DevForce 2012 today. 

Intersoft shares how to implement DevForce 2012 support in your existing applications.

In partnership with Intersoft Solutions, we extended their "ClientUI MVVM" sample application with DevForce model and persistence capabilities.

Key characteristics:

  • Two solutions, in WPF and Silverlight, that share the same source code and XAML
  • Demonstrates MVVM and Repository patterns
  • The views are Blendable and rely on design data delivered by ViewModels
  • It’s concise and easy to read
  • Includes a fifty page walkthrough that explains how it is put together and why
  • A terrific mash-up of DevForce and some great Intersoft UI controls

The series

The joint sample is evolving over time as a series of walkthroughs and companion code. There are two samples at the moment. The first focuses on conversion to DevForce and fundamentals. The second sample replaces the synchronous Contact editor with a "sandboxed" editor that isolates unsaved changes from the main view. The second sample is a super-set of the first and includes both walkthrough documents.

You can download the first sample or download the second instead and follow the two walkthroughs, back-to-back.

The first and second walkthrough documents can be downloaded separately, without the accompanying source code.

The contact application


The Intersoft “ClientUI Sample” was our inspiration. It’s a lovely demo of a Forms-Over-Data application – a “Contact Editor” built with Intersoft controls. The UI presents two views: one lists all Contacts; the second is an overlay dialog for editing the currently selected contact and address. A “contact” is a person with an address.


The application looks and behaves the same in both WPF and Silverlight flavors.

Intersoft APIs, like DevForce APIs, are identical for both WPF and Silverlight. You compile the same source code and xaml against the WPF and Silverlight libraries.

Intersoft’s original ClientUI sample followed an MVVM design. That made our DevForce integration job easy. We hardly touched the views. We replaced the original, hand-coded model with a DevForce generated model. We introduced a Repository and EntityManagerFactory, massaged the ViewModels, added a dash of configuration … and it was done.

The conversion process is covered in detail - with digressions on patterns used and design choices -  in a fifty page PDF that is part of the downloaded zip file.


The VB version attempts to be a straightforward  translation of the C# version.  However, there are some differences:

  1. The iterator approach to batching asynchronous tasks is a popular choice in C# and is the approach used in the C# version of BookShelf. That choice is not available to Visual Basic.NET programmers because iterators aren't implemented in VB.NET. Fortunately, you can still use the DevForce Coroutine class in VB to manage a sequence of asynchronous tasks. Instead of writing an iterator to produce the sequence, you construct a list of functions that return INotifyCompleted and pass the list to the Coroutine.  Since, it is not possible to use the standarad coutines in VB, use function lists instead.  This the approach used in this solution.  For example, look at this code in "ResetDataCore" which builds a List(Of Func(Of INotifyCompleted)) to register a new user:
    Private Function ResetDataCore(ByVal manager As IntersoftSampleEntities) As IEnumerable(Of Func(Of INotifyCompleted))

     ' Setup of the list of async functions for the Coroutine to execute serially.
     Dim operationList = New List(Of Func(Of INotifyCompleted))

      manager.QueryCache.Clear() ' forget all prior queries

     Dim f1 As Func(Of INotifyCompleted) =
          Function() manager.Contacts.Include(Contact.EntityPropertyNames.Address).ExecuteAsync()

     Dim f2 As Func(Of INotifyCompleted) =
           Return manager.SaveChangesAsync()
         End Function

     Return operationList
    End Function
  2. VB has problems with "Optional" arguments (especially when used with the "Implements" key word). Accordingly, some of the methods in this application were modified to not use "Optional".


The sample assumes you’ve installed IdeaBlade’s DevForce (6.0.9 or later, free version is fine) and Intersoft’s “ClientUI 2010” (v3.0.5000.11 or later, trial version is fine).

Created by DevForce on November 23, 2010 11:13

This wiki is licensed under a Creative Commons 2.0 license. XWiki Enterprise 3.2 - Documentation. Copyright © 2015 IdeaBlade