private void Application_Startup(object sender, StartupEventArgs e) { var args = e.Args; Window window = null; if (args.Length == 1 && Uri.TryCreate(args[0], UriKind.Absolute, out var uri) && uri.Scheme == ProtocolScheme) { var pageName = uri.AbsolutePath; if (pageName == "book") { window = new BookViewer(uri.Query); } } if (window == null) { window = new MainWindow(); } window.Show(); }