/// <summary> /// See interface docs. /// </summary> /// <param name="uPnpManager"></param> /// <param name="flightSimulatorXAircraftList"></param> public void Initialise(IUniversalPlugAndPlayManager uPnpManager, ISimpleAircraftList flightSimulatorXAircraftList) { _FlightSimulatorXAircraftList = flightSimulatorXAircraftList; _UPnpManager = uPnpManager; webServerStatusControl.UPnpIsSupported = true; // IsSupported was in the original UPnP code but was dropped in the re-write. Keeping UI elements for it in case I decide to put it back. }
/// <summary> /// Creates a new object. /// </summary> /// <param name="baseStationAircraftList"></param> /// <param name="flightSimulatorAircraftList"></param> /// <param name="uPnpManager"></param> /// <param name="webSite"></param> public PluginStartupParameters(IBaseStationAircraftList baseStationAircraftList, ISimpleAircraftList flightSimulatorAircraftList, IUniversalPlugAndPlayManager uPnpManager, IWebSite webSite) { AircraftList = baseStationAircraftList; FlightSimulatorAircraftList = flightSimulatorAircraftList; UPnpManager = uPnpManager; WebSite = webSite; }
/// <summary> /// Creates a new object. /// </summary> /// <param name="flightSimulatorAircraftList"></param> /// <param name="uPnpManager"></param> /// <param name="webSite"></param> /// <param name="pluginFolder"></param> public PluginStartupParameters(ISimpleAircraftList flightSimulatorAircraftList, IUniversalPlugAndPlayManager uPnpManager, IWebSite webSite, string pluginFolder) { FlightSimulatorAircraftList = flightSimulatorAircraftList; UPnpManager = uPnpManager; WebSite = webSite; PluginFolder = pluginFolder; }
public void TestInitialise() { _OriginalFactory = Factory.TakeSnapshot(); _RuntimeEnvironment = TestUtilities.CreateMockSingleton <IRuntimeEnvironment>(); _ConfigurationStorage = TestUtilities.CreateMockSingleton <IConfigurationStorage>(); _Configuration = new Configuration(); _ConfigurationStorage.Setup(c => c.Load()).Returns(_Configuration); _PortMappings = new List <IPortMapping>(); _Manager = Factory.Resolve <IUniversalPlugAndPlayManager>(); _Provider = new Mock <IUniversalPlugAndPlayManagerProvider>() { DefaultValue = DefaultValue.Mock }.SetupAllProperties(); _Provider.Setup(p => p.GetPortMappings()).Returns(_PortMappings); _Manager.Provider = _Provider.Object; _WebServer = new Mock <IWebServer>() { DefaultValue = DefaultValue.Mock }.SetupAllProperties(); _Manager.WebServer = _WebServer.Object; _StateChangedEvent = new EventRecorder <EventArgs>(); }
/// <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); } } }
/// <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 = Factory.Singleton.Resolve <ISplashView>()) { splashScreen.Initialise(args, BackgroundThread_ExceptionCaught); splashScreen.ShowView(); loadSucceded = splashScreen.LoadSucceeded; uPnpManager = splashScreen.UPnpManager; baseStationAircraftList = splashScreen.BaseStationAircraftList; flightSimulatorXAircraftList = splashScreen.FlightSimulatorXAircraftList; } try { if (loadSucceded) { var pluginManager = Factory.Singleton.Resolve <IPluginManager>().Singleton; foreach (var plugin in pluginManager.LoadedPlugins) { try { plugin.GuiThreadStartup(); } catch (Exception ex) { var log = Factory.Singleton.Resolve <ILog>().Singleton; log.WriteLine("Caught exception in {0} plugin while calling GuiThreadStartup: {1}", plugin.Name, ex); } } using (var mainWindow = Factory.Singleton.Resolve <IMainView>()) { _MainView = mainWindow; mainWindow.Initialise(uPnpManager, flightSimulatorXAircraftList); mainWindow.ShowView(); } } } finally { using (var shutdownWindow = Factory.Singleton.Resolve <IShutdownView>()) { shutdownWindow.Initialise(uPnpManager, baseStationAircraftList); shutdownWindow.ShowView(); Thread.Sleep(1000); } } }
public void TestInitialise() { _OriginalFactory = Factory.TakeSnapshot(); _RuntimeEnvironment = TestUtilities.CreateMockSingleton<IRuntimeEnvironment>(); _ConfigurationStorage = TestUtilities.CreateMockSingleton<IConfigurationStorage>(); _Configuration = new Configuration(); _ConfigurationStorage.Setup(c => c.Load()).Returns(_Configuration); _PortMappings = new List<IPortMapping>(); _Manager = Factory.Singleton.Resolve<IUniversalPlugAndPlayManager>(); _Provider = new Mock<IUniversalPlugAndPlayManagerProvider>() { DefaultValue = DefaultValue.Mock }.SetupAllProperties(); _Provider.Setup(p => p.GetPortMappings()).Returns(_PortMappings); _Manager.Provider = _Provider.Object; _WebServer = new Mock<IWebServer>() { DefaultValue = DefaultValue.Mock }.SetupAllProperties(); _Manager.WebServer = _WebServer.Object; _StateChangedEvent = new EventRecorder<EventArgs>(); }
/// <summary> /// See interface docs. /// </summary> /// <param name="uPnpManager"></param> /// <param name="baseStationAircraftList"></param> public void Initialise(IUniversalPlugAndPlayManager uPnpManager, IBaseStationAircraftList baseStationAircraftList) { _UPnpManager = uPnpManager; _BaseStationAircraftList = baseStationAircraftList; }
public void Initialise(IUniversalPlugAndPlayManager unused1, ISimpleAircraftList unused2) { ; }
#pragma warning restore 0067 public MainView(IUniversalPlugAndPlayManager uPnpManager, ISimpleAircraftList flightSimulatorXAircraftList) { _UPnpManager = uPnpManager; _FlightSimulatorXAircraftList = flightSimulatorXAircraftList; }
/// <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> public static void StartApplication(string[] args) { IUniversalPlugAndPlayManager uPnpManager = null; IBaseStationAircraftList baseStationAircraftList = null; ISimpleAircraftList flightSimulatorXAircraftList = null; bool loadSucceded = false; try { using (var splashScreen = Factory.Resolve <ISplashView>()) { splashScreen.Initialise(args, BackgroundThread_ExceptionCaught); splashScreen.ShowView(); loadSucceded = splashScreen.LoadSucceeded; uPnpManager = splashScreen.UPnpManager; baseStationAircraftList = splashScreen.BaseStationAircraftList; flightSimulatorXAircraftList = splashScreen.FlightSimulatorXAircraftList; } var shutdownSignalHandler = Factory.ResolveSingleton <IShutdownSignalHandler>(); try { if (loadSucceded) { var pluginManager = Factory.ResolveSingleton <IPluginManager>(); foreach (var plugin in pluginManager.LoadedPlugins) { try { plugin.GuiThreadStartup(); } catch (Exception ex) { var log = Factory.ResolveSingleton <ILog>(); log.WriteLine($"Caught exception in {plugin.Name} plugin while calling GuiThreadStartup: {ex}"); } } try { using (var mainWindow = Factory.Resolve <IMainView>()) { MainView = mainWindow; mainWindow.Initialise(uPnpManager, flightSimulatorXAircraftList); shutdownSignalHandler.CloseMainViewOnShutdownSignal(); mainWindow.ShowView(); } } finally { MainView = null; } } } finally { shutdownSignalHandler.Cleanup(); using (var shutdownWindow = Factory.Resolve <IShutdownView>()) { shutdownWindow.Initialise(uPnpManager, baseStationAircraftList); shutdownWindow.ShowView(); Thread.Sleep(1000); } Factory.ResolveSingleton <ILog>().WriteLine("Clean shutdown complete"); } } finally { _ShutdownCompleteWaitHandle.Set(); } }
/// <summary> /// See interface docs. /// </summary> /// <param name="uPnpManager"></param> /// <param name="baseStationAircraftList"></param> /// <param name="flightSimulatorXAircraftList"></param> public void Initialise(IUniversalPlugAndPlayManager uPnpManager, IBaseStationAircraftList baseStationAircraftList, ISimpleAircraftList flightSimulatorXAircraftList) { _BaseStationAircraftList = baseStationAircraftList; _FlightSimulatorXAircraftList = flightSimulatorXAircraftList; _UPnpManager = uPnpManager; webServerStatusControl.UPnpIsSupported = true; // IsSupported was in the original UPnP code but was dropped in the re-write. Keeping UI elements for it in case I decide to put it back. }
/// <summary> /// See interface docs. /// </summary> /// <param name="uPnpManager"></param> /// <param name="flightSimulatorXAircraftList"></param> public void Initialise(IUniversalPlugAndPlayManager uPnpManager, ISimpleAircraftList flightSimulatorXAircraftList) { _UPnpManager = uPnpManager; }