using System; using System.Windows; namespace Tests.Caliburn { public abstract class DispatcherTestBase { static DispatcherTestBase() { Action a = delegate { Application app = new Application(); app.Run(); }; a.BeginInvoke(null, null); } public void ExecuteWithDispatcher(RoutedEventHandler action) { ClosingWindow window = new ClosingWindow(); window.Loaded += action; window.ShowInTaskbar = false; window.Hide(); } #region Nested type: ClosingWindow private class ClosingWindow : Window { protected override void OnActivated(EventArgs e) { base.OnActivated(e); Close(); } } #endregion } }