public static async Task <bool> Start(IApplication clientApplication, bool disableDevices, string dataDirectory, bool openExecution = true, IProgress <Tuple <int, string> > progress = null) { if (_state == RunState.Stopped) { try { Logging.Info("Vixen System starting up..."); _state = RunState.Starting; ApplicationServices.ClientApplication = clientApplication; Instrumentation = new Instrumentation.Instrumentation(); await LoadConfiguration(disableDevices, dataDirectory, progress); if (openExecution) { Execution.OpenExecution(); } _state = RunState.Started; Logging.Info("Vixen System successfully started."); } catch (Exception ex) { // The client is expected to have subscribed to the logging event // so that it knows that an exception occurred during loading. Logging.Error(ex, "Error during system startup!"); return(false); } } return(true); }
static public void Start(IApplication clientApplication, bool openExecution = true, bool disableDevices = false, string dataRootDirectory = null) { if (_state == RunState.Stopped) { try { _state = RunState.Starting; ApplicationServices.ClientApplication = clientApplication; // A user data file in the binary branch will give any alternate // data branch to use. Paths.DataRootPath = dataRootDirectory ?? _GetUserDataPath(); _InitializeLogging(); Logging.Info("Vixen System starting up..."); Instrumentation = new Instrumentation.Instrumentation(); ModuleImplementation[] moduleImplementations = Modules.GetImplementations(); // Build branches for each module type. foreach (ModuleImplementation moduleImplementation in moduleImplementations) { Helper.EnsureDirectory(Path.Combine(Modules.Directory, moduleImplementation.TypeOfModule)); } // There is going to be a "Common" directory for non-module DLLs. // This will give them a place to be other than the module directories. // If they're in a module directory, the system will try to load them and // it will result in an unnecessary log notification for the user. // All other binary directories (module directories) have something driving // their presence, but this doesn't. So it's going to be a blatantly // ugly statement for now. Helper.EnsureDirectory(Path.Combine(Paths.BinaryRootPath, "Common")); // Load all module descriptors. Modules.LoadAllModules(); LoadSystemConfig(); // Add modules to repositories. Modules.PopulateRepositories(); if (disableDevices) { SystemConfig.DisabledDevices = OutputDeviceManagement.Devices; } if (openExecution) { Execution.OpenExecution(); } _state = RunState.Started; Logging.Info("Vixen System successfully started."); } catch (Exception ex) { // The client is expected to have subscribed to the logging event // so that it knows that an exception occurred during loading. Logging.Error("Error during system startup; the system has been stopped.", ex); Stop(); } } }
public static void Start(IApplication clientApplication, bool openExecution = true, bool disableDevices = false, string dataRootDirectory = null) { if (_state == RunState.Stopped) { try { _state = RunState.Starting; ApplicationServices.ClientApplication = clientApplication; // A user data file in the binary branch will give any alternate // data branch to use. Paths.DataRootPath = dataRootDirectory ?? _GetUserDataPath(); Logging.Info("Vixen System starting up..."); Instrumentation = new Instrumentation.Instrumentation(); ModuleImplementation[] moduleImplementations = Modules.GetImplementations(); // Build branches for each module type. foreach (ModuleImplementation moduleImplementation in moduleImplementations) { Helper.EnsureDirectory(Path.Combine(Modules.Directory, moduleImplementation.TypeOfModule)); } // There is going to be a "Common" directory for non-module DLLs. // This will give them a place to be other than the module directories. // If they're in a module directory, the system will try to load them and // it will result in an unnecessary log notification for the user. // All other binary directories (module directories) have something driving // their presence, but this doesn't. So it's going to be a blatantly // ugly statement for now. Helper.EnsureDirectory(Path.Combine(Paths.BinaryRootPath, "Common")); // Load all module descriptors. Modules.LoadAllModules(); LoadSystemConfig(); // Add modules to repositories. Modules.PopulateRepositories(); if (disableDevices) { SystemConfig.DisabledDevices = OutputDeviceManagement.Devices; } if (openExecution) { Execution.OpenExecution(); } _state = RunState.Started; Logging.Info("Vixen System successfully started."); } catch (Exception ex) { // The client is expected to have subscribed to the logging event // so that it knows that an exception occurred during loading. Logging.ErrorException("Error during system startup; the system has been stopped.", ex); Stop(); } } }
public static bool Start(IApplication clientApplication, bool openExecution = true, bool disableDevices = false, string dataRootDirectory = null) { if (_state == RunState.Stopped) { try { _state = RunState.Starting; ApplicationServices.ClientApplication = clientApplication; // A user data file in the binary branch will give any alternate // data branch to use. Paths.DataRootPath = dataRootDirectory ?? _GetUserDataPath(); Logging.Info("Vixen System starting up..."); Instrumentation = new Instrumentation.Instrumentation(); ModuleImplementation[] moduleImplementations = Modules.GetImplementations(); // Build branches for each module type. foreach (ModuleImplementation moduleImplementation in moduleImplementations) { Helper.EnsureDirectory(Path.Combine(Modules.Directory, moduleImplementation.TypeOfModule)); } // There is going to be a "Common" directory for non-module DLLs. // This will give them a place to be other than the module directories. // If they're in a module directory, the system will try to load them and // it will result in an unnecessary log notification for the user. // All other binary directories (module directories) have something driving // their presence, but this doesn't. So it's going to be a blatantly // ugly statement for now. Helper.EnsureDirectory(Path.Combine(Paths.BinaryRootPath, "Common")); // Load all module descriptors. Modules.LoadAllModules(); LoadSystemConfig(); DefaultUpdateTimeSpan = TimeSpan.FromMilliseconds(SystemConfig.DefaultUpdateInterval); // Add modules to repositories. Modules.PopulateRepositories(); if (disableDevices) { SystemConfig.DisabledDevices = OutputDeviceManagement.Devices; } if (MigrationOccured) { //save the configs to ensure they do not get lost. We no longer automatically save on close. SaveSystemAndModuleConfigAsync(); MigrationOccured = false; } if (openExecution) { Execution.OpenExecution(); } //var temp = Modules.ModuleManagement.GetEffect(new Guid("{32cff8e0-5b10-4466-a093-0d232c55aac0}")); //if (temp == null) //{ // Logging.Error("Module Management init error!"); //} _state = RunState.Started; Logging.Info("Vixen System successfully started."); } catch (Exception ex) { // The client is expected to have subscribed to the logging event // so that it knows that an exception occurred during loading. Logging.Error("Error during system startup!", ex); return(false); } } return(true); }