Modify your app.xaml so you have control of how your app starts:
<Application x:Class="WpfTutorialSamples.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Startup="Application_Startup">
<Application.Resources></Application.Resources>
</Application>
Then you can use the arguments:
using System;
using System.Collections.Generic;
using System.Windows;
namespace WpfTutorialSamples
{
public partial class App : Application
{
private void Application_Startup(object sender, StartupEventArgs e)
{
MainWindow wnd = new MainWindow();
if(e.Args.Length == 1)
MessageBox.Show("Now opening file: \n\n" + e.Args[0]);
wnd.Show();
}
}
}
http://www.wpf-tutorial.com/wpf-application/command-line-parameters/
You can then add them to resources so you can access them in any viewmodel, in a nice decoupled sort of a way:
Application.Current.Resources.Add("YourKey", YourObject);