title: send parameter from view-model to constructor of another view-model vol.2
body: <p>I try implement advance on my question form here: <a href="https://stackoverflow.com/questions/4450712/send-parameter-from-view-model-to-constructor-of-another-view-model">send parameter from view-model to constructor of another view-model</a>.</p>
  
  <p>I have one shell-view model and 2 view-model. I need pass object from one view-model to other view model(constructor.)</p>
  
  <p>My view models look like this:</p>
  
  <p><strong>LogOnViewModel:</strong></p>
  
  <pre><code>public interface ILogOnViewModel : IScreen, IDataErrorInfo
  {
      string Nick { get; set; }
      string Password { get; set; }
      bool CanLogOn { get; set; }
      void LogOn(string nick, string password);
  }
  
  
  public class LogOnViewModel : Screen,ILogOnViewModel
  {
  
      //[Import]
      //private IShellViewModel _shellViewModel;
  }
  </code></pre>
  
  <p><strong>MessangerViewModel:</strong></p>
  
  <pre><code> public interface  IMessengerViewModel:IScreen
      {
          BitmapImage AvatarImage { get; set; }
          string AvatarStatus { get; set; }
          KeyValuePair&lt;string, Friend&gt; SelectedFriend { get; set; }
      }
  
      public class MessengerViewModel : Screen,IMessengerViewModel
      {
      }
  </code></pre>
  
  <p>In shell-view model I try make abstract factory for view-models.</p>
  
  <p><strong>ShellViewModel:</strong></p>
  
  <pre><code> public interface IFactory
      {
          ILogOnViewModel CreateLogOnViewModel();
          IMessengerViewModel CreateMessengerViewModel();
      }
  
      public class ConcreteFactory : IFactory
      {
          #region Implementation of IFactory
  
          public ILogOnViewModel CreateLogOnViewModel()
          {
              return new LogOnViewModel();
          }
  
          public IMessengerViewModel CreateMessengerViewModel()
          {
              return new MessengerViewModel();
          }
  
          #endregion
      }
  
  
      public interface IShellViewModel
      {
          void ShowLogOnView();
          void ShowMessengerView();
      }
  
      [Export(typeof(IShellViewModel))]
      public class ShellViewModel : Conductor&lt;IScreen&gt;, IShellViewModel
      {
          private ConcreteFactory _factory;
  
          public ShellViewModel()
          {
              _factory=new ConcreteFactory();
              ShowLogOnView();
          }
  
          public void ShowLogOnView()
          {
              ActivateItem(_factory.CreateLogOnViewModel());
              //ActivateItem(IoC.Get&lt;LogOnViewModel&gt;());
          }
  
          public void ShowMessengerView()
          {
              ActivateItem(_factory.CreateMessengerViewModel());
              //ActivateItem(IoC.Get&lt;MessengerViewModel&gt;());
          }
      }
  </code></pre>
  
  <p>My problem is : How can I call method from Shell-view-model in LogOnVieModel. I get advance that is bad use IoC and import attribute on inport shell-view-model into another view. Supposudely is better use event agrregator on this. But I dont know how use this class in my problem. </p>
  
  <p>I think, publish method from shell-view-model and handle in logon-view-model.</p>
  
  <p>But I think that all I do now is bad.</p>