private void StartDispatcher() { app = new TestApp { ShutdownMode = ShutdownMode.OnExplicitShutdown }; app.Startup += (sender, args) => gate.Set(); app.Run(); }