Exemplo n.º 1
0
        public async Task StartAsync(CancellationToken cancellationToken = default)
        {
            configurationLoader
            .LoadConfigurationFromXml(configuration, Path.Combine(typeof(Startup).GetLocation(), "config.xml"));

            logger.LogInformation("Added configuration from config.xml");

            var modules = moduleLoader.GetModules(configuration);

            foreach (var module in modules)
            {
                currentModule = module;
                await currentModule
                .RunAsync(cancellationToken);
            }
        }
Exemplo n.º 2
0
        public ObjectModel(IModuleLoader modules)
        {
            modules.Scan(); // Scan to ensure we have an up to date list of modules.

            var module = modules.GetModules().FirstOrDefault(m => m.ObjectModel);

            if (module != null)
            {
                this.InstalledVersion = module.Version;
            }

            AutoUpdate.Updater <ObjectModel> .Mandatory            = true;
            AutoUpdate.Updater <ObjectModel> .UpdateMode           = Mode.ForcedDownload;
            AutoUpdate.Updater <ObjectModel> .DownloadPath         = modules.DataPath;
            AutoUpdate.Updater <ObjectModel> .CheckForUpdateEvent += (UpdateInfoEventArgs args) =>
            {
                if (args == null)
                {
                    return;
                }
                if (args.IsUpdateAvailable)
                {
                    AutoUpdate.Updater <ObjectModel> .DownloadUpdate();

                    AutoUpdate.Updater <ObjectModel> .Exit();

                    modules.Scan();
                }

                modules.Load();
            };
            AutoUpdate.Updater <ObjectModel> .ApplicationExitEvent += () =>
            {
                int i = 0;
            };

            if (CoreExtensionApplication._current.Configuration.EnableObjectModelUpdate)
            {
                AutoUpdate.Updater <ObjectModel> .Start(CoreExtensionApplication._current.Configuration.ObjectModelUrl, this);
            }
            else
            {
                modules.Scan();
                modules.Load();
            }
        }