Well, it took me around 8 hours but I finally figured it out.
I had to change App.xaml.cs to:
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
if (e.Args.Length > 0)
{
MessageBox.Show(e.Args[0]);
MessageBox.Show("In the if statement");
MainWindow mw = new MainWindow(e.Args);
mw.Show();
}
else
{
MessageBox.Show("In the Else statement");
MainWindow mw = new MainWindow();
mw.Show();
}
I had to make another MainWindow constructor to use for "Open With".
If I just open the program normally then I use the constructor with the empty parameters.
In the MainWindow.xaml.cs I added a constructor that took a string[] argument.
public MainWindow(string[] args)
{
MessageBox.Show(args[0]);
mediaplayer.Source = new Uri(args[0]);