protected override void OnStartup(StartupEventArgs e) { if (e.Args?.Any() == true) { Properties["ArbitraryArgName"] = e.Args[0]; } // For now we want to allow multiple instances if app is started without args if (Mutex.TryOpenExisting(_instanceMuxet, out var mutex)) { var client = new PipeClient(Config.PipeEndpoint); if (e.Args.Any()) { client.InvokeCommand(CmdlineCommands.Open, e.Args[0]); Shutdown(); return; } } else { _appMutex = new Mutex(true, _instanceMuxet); OriginalInstance = true; } if (Resources["bootstrapper"] == null) { StartupUri = new System.Uri(@"Windows\MainWindow.xaml", System.UriKind.Relative); } else { ShutdownMode = ShutdownMode.OnLastWindowClose; } base.OnStartup(e); }