Search code examples
c#windows-store-appsmvvmcrosswindows-store

Passing argument from app onlaunched to mvvmcross


From my Window Store app, I want to use the launch arguments coming from a toast into the app.xaml OnLaunched method. This launch argument might be a small JSON string or an ID to a model, I haven't decided. Now how do I pass it to mvvmcross for use from my view models?

Do I register it into the Ioc? Or can I use the optional parameter from the IMvxAppStart.Start method

      var start = Cirrious.CrossCore.Mvx.Resolve<Cirrious.MvvmCross.ViewModels.IMvxAppStart>();
      start.Start(e.Arguments);

Thanks in advance!


Solution

  • Yes - you can use either of the mechanisms you suggest - it's just C# code and it's free for you to use.

    There's some notes on how to use AppStart for this purpose in https://speakerdeck.com/cirrious/appstart-in-mvvmcross