public static void Main() { Master_Media shapes = new Master_Media(); Thread appThread = new Thread(new ThreadStart(shapes.ApplicationThread)); appThread.Start(); //wait until UI Window is created autoEvent.WaitOne(); string[] args = { "BrushTests", "ColorTests", "DrawingContextTests" }; MFTestRunner runner = new MFTestRunner(args); Log.Comment("Aborting the Application Thread"); try { shapes.app.Dispatcher.Invoke(new TimeSpan(0, 0, 5), new DispatcherOperationCallback(shapes.ShutDownApp), null); appThread.Abort(); } catch (Exception ex) { Log.Comment("Caught : " + ex.Message + " when aborting the application thread"); } }