title: Proper way of using MVVM Light Messenger
body: <p>What is the proper way to use <code>Messenger</code> class ?
  I know it can be used for ViewModels/Views communications, but is it a good approach to use it in for a technical/business service layer ?</p>
  
  <p>For example, a logging/navigation service registers for some messages in the constructors and is aware when these messages occurs in the app. The sender (ViewModel ou Service) does not reference the service interface but only messenger for sending messages. Here is a sample service :</p>
  
  <pre><code>using System;
  using System.Windows;
  using System.Windows.Navigation;
  using Microsoft.Phone.Controls;
  using App.Service.Interfaces;
  using GalaSoft.MvvmLight.Messaging;
  
  namespace App.Service
  {
      public class NavigationService : INavigationService
      {
          private PhoneApplicationFrame _mainFrame;
  
          public event NavigatingCancelEventHandler Navigating;
  
          public NavigationService()
          {
              Messenger.Default.Register&lt;NotificationMessage&lt;Uri&gt;&gt;(this, m =&gt; { this.NavigateTo(m.Content); });
          }
  
          public void NavigateTo(Uri pageUri)
          {
              if (EnsureMainFrame())
              {
                  _mainFrame.Navigate(pageUri);
              }
          }
  
          public void GoBack()
          {
              if (EnsureMainFrame()
                  &amp;&amp; _mainFrame.CanGoBack)
              {
                  _mainFrame.GoBack();
              }
          }
  
          private bool EnsureMainFrame()
          {
              if (_mainFrame != null)
              {
                  return true;
              }
  
              _mainFrame = Application.Current.RootVisual as PhoneApplicationFrame;
  
              if (_mainFrame != null)
              {
                  // Could be null if the app runs inside a design tool
                  _mainFrame.Navigating += (s, e) =&gt;
                  {
                      if (Navigating != null)
                      {
                          Navigating(s, e);
                      }
                  };
  
                  return true;
              }
  
              return false;
          }
      }
  }
  </code></pre>