Transcript This is the identity mine - GalaSoft Laurent Bugnion
DEEP DIVE MVVM
Laurent Bugnion Director, UX Integration IdentityMine http://blog.galasoft.ch
LAST YEAR WE…
1. Talked about the history of MVVM 2. Cleared some confusion 3. Refactored a non-MVVM application 4. Made it Blendable 5. Talked about additional components 6. Did a more complex demo © 2011 IdentityMine Inc. All Rights Reserved.
Page: 3
AND THEN CAME THE QUESTIONS…
• • • • • • How do you avoid redundancy?
How do you start animations?
How do you show dialogs?
How do you do navigation?
How do you handle multiple VMs?
How do you test your VMs?
© 2011 IdentityMine Inc. All Rights Reserved.
Page: 5
© 2010 IdentityMine Inc. All Rights Reserved.
Page: 6
© 2010 IdentityMine Inc. All Rights Reserved.
Page: 7
DEMO Connecting to JSON
VIEWMODEL
VIEW
MessageBox Animations Navigation
ViewModel View • • Complicates the testing, hard coupling Hard to design and tweak © 2010 IdentityMine Inc. All Rights Reserved.
Page: 9
VIEWMODEL
VIEW
Binding
ViewModel View • • Loose coupling, more flexibility Behavior is highly Blendable © 2011 IdentityMine Inc. All Rights Reserved.
Page: 10
INJECTING VIEW SERVICES
ViewModel
IDialogService injection injection
DialogService View
INavigationService action
NavigationService © 2011 IdentityMine Inc. All Rights Reserved.
Page: 11
DEMO Behaviours Injecting View Services Navigation
INJECTING VIEW SERVICES
ViewModel
IDialogService injection injection
DialogService View
INavigationService action
NavigationService © 2011 IdentityMine Inc. All Rights Reserved.
Page: 13
TESTING THE VIEWMODEL
ViewModel
IDialogService
DialogService View Unit Test MockDialogService © 2011 IdentityMine Inc. All Rights Reserved.
Page: 14
TESTING THE VIEWMODEL
Unit test on WP7 cheat sheet: http://www.smartypantscoding.com/a-cheat sheet-for-unit-testing-silverlight-apps-on windows-phone-7 © 2011 IdentityMine Inc. All Rights Reserved.
Page: 15
DEMO Unit Testing ViewModels Mocking Services
FURTHER INFORMATION
http://blog.galasoft.ch
http://www.galasoft.ch/mvvm/ http://mvvmlight.codeplex.com
Twitter: @LBugnion #deepdivemvvm
Please fill out your evaluation forms…