Update: Version 1.0 of Simple MVVM Toolkit Express has now been released and is based on version 1.0 RTM of .NET Core: https://www.nuget.org/packages/SimpleMvvmToolkit.Express. Source code and samples can be found here: https://github.com/SimpleMvvm
Now that .NET Core is stable and RC2 has been released, and the .NET Platform Standard has been proposed to replace Portable Class Libraries, I thought it would be a good idea to port my Simple MVVM Toolkit to .NET Core and provide support for additional platforms, such as Universal Windows Platform and the latest version of Xamarin for cross-platform mobile apps, included iOS from Apple and Android from Google.
Rather than update my existing repository, I decided it was time for a fresh start. So I createed a new project on GitHub called Simple MVVM Toolkit Express. It is compatible with the following platforms:
- Portable Class Libraries: Profile 111 – .NET 4.5, AspNet Core 1.0, Windows 8, Windows Phone 8.1
- .NET Framework 4.6
- Universal Windows Platform 10.0
- Mono/Xamarin: MonoAndroid60, XamariniOS10
- .NET Core 1.0: NetStandard 1.3
I decided to break compatibility with the following legacy frameworks: .NET 4.0 and Silverlight.
The toolkit has all the major features of the classic version, including classes for models and view models, support for validation and editing with rollbacks, as well as a leak-proof message bus (aka mediator or event aggregator). Platform-specific threading implementations have been removed, because it’s better to use C#’s built-in async support.
I published a pre-release NuGet package, which you can find here: https://www.nuget.org/packages/SimpleMvvmToolkit.Express. And I’ve created samples for WPF, UWP and Xamarin, which you can find on the SimpleMvvm home repository.
I used the dotnet CLI (command-line interface) tool chain to build the project and generate a multi-targeted NuGet package, but I had to modify the generated nuspec file to work around some compatibility issues. In the end, it was a great learning experience, and I found it reassuring that I could continue to use a popular framework for building many different kinds of client applications using the Model-View-ViewModel design pattern.
Happy coding!
Hi Tony, Thanks for all the great work that you are doing and the time taken to explain stuff. I am trying to use your new express library and trying to use the MessageBus in particular. Are there any examples that I can reference on this, not entirely sure how to implement and notify between viewmodels.
You can download the samples here: https://github.com/tonysneed/SimpleMvvmToolkit/tree/master/Samples/VS2013
The MessageBus sample is here: https://github.com/tonysneed/SimpleMvvmToolkit/tree/master/Samples/VS2013/Misc/SimpleMvvm-Messaging
Sorry me again. I don’t see any RegisterToReceive methods for subscribing on the new library. Maybe taking a step back, can I use the new library (SimpleMvvm.Express) or do you need to do more work on this? Also the MessageBus class creates a singleton by the looks of it but doesn’t inherit the MessageBusCore or use it as far as I can see (Hope this doesn’t give away my noobness, if so please excuse), do I still use it then from within the viewmodels? Thank in advance. Jaco
I’ll take a look at this.
Thank you
Beta 1 of the toolkit was based on some beta NuGet packages for .NET Core and had some things missing. I updated the NuGet packages to RTM for .NET Core, added the missing pieces, and set the version to 1.0. Note that all the *Core classes have been removed, because they are no longer needed for cross-platform compatibility.
I created a sample for using the Message Bus: SimpleMvvmToolkit.Samples.Messaging. Enjoy!
Thank you so much. Looking at it right now.
Note the use of SynchronizationContext in the sample, which is now needed because the Express edition does not provide thread marshaling (each UI platform handles that differently).
Thanks. Working like a charm and it feels just so responsive! Well done and thanks for all the help! Much appreciated!
Thanks to you for prodding me to push out the v1 release! 🙂
Pingback: 3 .NET Experts You Oughta Know | Codango.Com
I’m confused… are there no project types in the latest version? I was expecting to find an installation file which would include Visual Studio project templates, but I see only the github package. This means I need to create my project first (using what template?) and then add SimpleMVVM to it using the package manager.
The Express version only has NuGet packages. So you need to look at the sample apps of the regular version for an example of the classes you need to create.