Blog Pages

Friday, May 03, 2013

N=9 - Getting the Message (N+1 Days of MvvmCross)

Following on from N=8, I decided to refactor the Location sample so that it used the Messenger plugin.







I don't think this was the best of demos... but we will come back and use the Mvvmcross Messenger a **lot** in future samples - http://nuget.org/packages/MvvmCross.HotTuna.Plugin.Messenger/ - so I'll try to explain it again better then :)



The code is in: https://github.com/slodge/NPlus1DaysOfMvvmCross/tree/master/N-09-Location%20And%20Message




Previously in N+1:

6 comments:

  1. Can you perhaps elaborate on the benefit of using the Messenger as compared with ordinary events?

    ReplyDelete
    Replies
    1. I think best to ask that question on stackoverflow with tags 'messenger', 'mvvm' and 'mvvmcross' - there should be plenty of people with plenty of interesting and different opinions :)

      Delete
  2. Oh, and thanks for sharing, I've enjoyed the series immensely :).

    ReplyDelete
  3. You mentioning weak references etc. made me wonder about the lifecycle of the View Models themselves. Perhaps this is just my lack of experience with MVVM (I'm really a web, server side developer) but do the View Models get released as the application is navigated between View Models or are they kept around? I can see issues with both approaches.

    ReplyDelete
    Replies
    1. ViewModels should live as long as their views do - that's it. But how long the views live is determined by each OS... There's some information on a topic similar to this in http://stackoverflow.com/questions/16299639/detecting-whether-a-viewmodels-associated-view-is-showing-not-showing - if you want more than that, then please ask a new question on SO. Thanks :)

      Delete
    2. The question just popped into my head as I was watching the video, your reply was just the right level, thanks. Great series by the way.

      Delete