/// <summary> /// Displays the splash screen (whose presenter builds up most of the objects used by the program) and then the /// main view once the splash screen has finished. When the main view quits the program shuts down. /// </summary> /// <param name="args"></param> private static void StartApplication(string[] args) { IUniversalPlugAndPlayManager uPnpManager = null; IBaseStationAircraftList baseStationAircraftList = null; ISimpleAircraftList flightSimulatorXAircraftList = null; bool loadSucceded = false; using (var splashScreen = new SplashView()) { splashScreen.Initialise(args, BackgroundThread_ExceptionCaught); splashScreen.ShowDialog(); loadSucceded = splashScreen.LoadSucceeded; uPnpManager = splashScreen.UPnpManager; baseStationAircraftList = splashScreen.BaseStationAircraftList; flightSimulatorXAircraftList = splashScreen.FlightSimulatorXAircraftList; } try { if (loadSucceded) { using (var mainWindow = new MainView()) { _MainView = mainWindow; mainWindow.Initialise(uPnpManager, baseStationAircraftList, flightSimulatorXAircraftList); mainWindow.ShowDialog(); } } } finally { using (var shutdownWindow = new ShutdownView()) { shutdownWindow.Initialise(uPnpManager, baseStationAircraftList); shutdownWindow.ShowDialog(); Thread.Sleep(1000); } } }