void AppStartup(object sender, StartupEventArgs args) { if (args.Args.Length > 0) { if (args.Args[0] == "/noautoload") __NoAutoLoad = true; else { Properties["FileNameToOpen"] = args.Args[0]; } } __ExecutableFile = Environment.GetCommandLineArgs()[0]; MainWindow mainWindow = new MainWindow(); mainWindow.Dispatcher.UnhandledException += new System.Windows.Threading.DispatcherUnhandledExceptionEventHandler(Dispatcher_UnhandledException); mainWindow.Show(); }