by Laurent Bugnion via Silverlight on 4/13/2011 1:04:27 PM
Here is the sample code I demoed in my MIX11 session “Deep Dive MVVM”. Please download the Zip file, and then unblock it in Windows Explorer by right-clicking it, and then selecting Properties. If you see an “Unblock” button, please click it. You can then extract the content of the Zip file on your hard drive.
The slides are also available for download.
To fully understand this session, an understanding of what MVVM is should be available. I recommend the following links:
The video of Deep Dive MVVM is already available for download (awesome job, MIX team). Go to the MIX website to download it in various formats, or stream it.
To execute the samples, you should have Visual Studio 2010 as well as the Windows Phone 7 tools installed.
In order to run the JsonDemo sample, you need to run the web application first because the Facebook service simulation is local. The easiest way is to right click on JsonDemo.SL4TestPage.html and select “View in Browser” from the context menu. This will start the development web server in Visual Studio. Then, you can run the WP7 application in the emulator.
For your convenience, I added the snippets of code that I was dragging/dropping from the Toolbox during the session. The file “snippets.txt” is included inside the ZIP file.
This is the start state, which will compile and run fine, but without the added functionality we built in during the session.
This is the state of the application after the first demo, where all the objects are wired up and connected, and the message is sent from the MasterViewModel to the DetailsViewModel. We also added the IsOlderThanMeIndicatorVisibility property and connected it to the corresponding Rectangle in the DataTemplate (in the MasterView).
This is the state after adding the “please wait” animation, the states and connecting the MasterViewModel’s IsBusy property to the GoToStateAction and ControlStoryboardAction instances through the DataTrigger. In Windows Phone 7, we added some code behind to replicate the functionality.
In this section we added a view service, the IDialogService, to the WP7 application and implemented it to display a custom message box. In SL4, the functionality is also available although no custom message box was made, so the fallback MessageBox is used instead.
This section introduces another view service, the INavigationService with one implementation in Silverlight 4 and one for Windows Phone 7.
In this last section, we add unit tests (with mock, well precisely with stubs!) to the Silverlight 4 and to the Windows Phone 7 applications. This is the final state of the demo.
I hope that this session was helpful, and that it will help you build awesome MVVM applications!
Happy coding,
Laurent
Original Post: Deep Dive MVVM samples #mix11 #deepdivemvvm
The content of the postings is owned by the respective author. Silverlight Feeds is not responsible for the contents of the postings. This site is automatically generated and cannot be reviewed for abusive content. If you find abusive content on Silverlight Feeds, please contact us. Designated trademarks and brands are the property of their respective owners. All rights reserved.