Exemple #1
0
        public HostingEngine(
            IServiceCollection appServices,
            IStartupLoader startupLoader,
            IConfiguration config,
            bool captureStartupErrors)
        {
            if (appServices == null)
            {
                throw new ArgumentNullException(nameof(appServices));
            }

            if (startupLoader == null)
            {
                throw new ArgumentNullException(nameof(startupLoader));
            }

            if (config == null)
            {
                throw new ArgumentNullException(nameof(config));
            }

            _config = config;
            _applicationServiceCollection = appServices;
            _startupLoader = startupLoader;
            _captureStartupErrors = captureStartupErrors;
            _applicationLifetime = new ApplicationLifetime();
            _applicationServiceCollection.AddInstance<IApplicationLifetime>(_applicationLifetime);
        }
        public static async Task DevicesCrossReferenceIDsWithMinerIndexes(IStartupLoader loader)
        {
            // get devices
            var baseDevices = AvailableDevices.Devices.Select(dev => dev.BaseDevice);
            var checkPlugins = PluginContainer.PluginContainers
                .Where(p => p.IsCompatible)
                .Where(p => p.Enabled)
                .ToArray();

            if (checkPlugins.Length > 0 && loader != null) {
                loader.SecondaryVisible = true;
                loader.SecondaryTitle = Translations.Tr("Devices Cross Reference");
                loader?.SecondaryProgress?.Report((Translations.Tr("Pending"), 0));
            }
            var pluginDoneCount = 0d;
            foreach (var plugin in checkPlugins)
            {
                
                loader?.SecondaryProgress?.Report((Translations.Tr("Cross Reference {0}", plugin.Name), (int)((pluginDoneCount / checkPlugins.Length) * 100)));
                await plugin.DevicesCrossReference(baseDevices);
                pluginDoneCount += 1;
                loader?.SecondaryProgress?.Report((Translations.Tr("Cross Reference {0}", plugin.Name), (int)((pluginDoneCount / checkPlugins.Length) * 100)));
            }
            if (loader != null)
            {
                loader.SecondaryVisible = false;
            }
        }
        public StartupLoadingWindow()
        {
            InitializeComponent();

            StartupLoader = this.AssertViewModel <StartupLoadingVM>();
            //WindowUtils.InitWindow(this);
        }
Exemple #4
0
        public WebApplication(
            IServiceCollection appServices,
            IStartupLoader startupLoader,
            WebApplicationOptions options,
            IConfiguration config)
        {
            if (appServices == null)
            {
                throw new ArgumentNullException(nameof(appServices));
            }

            if (startupLoader == null)
            {
                throw new ArgumentNullException(nameof(startupLoader));
            }

            if (config == null)
            {
                throw new ArgumentNullException(nameof(config));
            }

            _config = config;
            _options = options;
            _applicationServiceCollection = appServices;
            _startupLoader = startupLoader;
            _applicationLifetime = new ApplicationLifetime();
            _applicationServiceCollection.AddSingleton<IApplicationLifetime>(_applicationLifetime);
        }
Exemple #5
0
 public StartupLoader(
     IServiceProvider services,
     IStartupLoader next)
 {
     _services = services;
     _next     = next;
 }
Exemple #6
0
        public WebHost(
            IServiceCollection appServices,
            IStartupLoader startupLoader,
            WebHostOptions options,
            IConfiguration config)
        {
            if (appServices == null)
            {
                throw new ArgumentNullException(nameof(appServices));
            }

            if (startupLoader == null)
            {
                throw new ArgumentNullException(nameof(startupLoader));
            }

            if (config == null)
            {
                throw new ArgumentNullException(nameof(config));
            }

            _config  = config;
            _options = options;
            _applicationServiceCollection = appServices;
            _startupLoader       = startupLoader;
            _applicationLifetime = new ApplicationLifetime();
            _applicationServiceCollection.AddSingleton <IApplicationLifetime>(_applicationLifetime);
        }
Exemple #7
0
        public HostingEngine(
            IServiceCollection appServices,
            IStartupLoader startupLoader,
            IConfiguration config,
            bool captureStartupErrors)
        {
            if (appServices == null)
            {
                throw new ArgumentNullException(nameof(appServices));
            }

            if (startupLoader == null)
            {
                throw new ArgumentNullException(nameof(startupLoader));
            }

            if (config == null)
            {
                throw new ArgumentNullException(nameof(config));
            }

            _config = config;
            _applicationServiceCollection = appServices;
            _startupLoader        = startupLoader;
            _captureStartupErrors = captureStartupErrors;
            _applicationLifetime  = new ApplicationLifetime();
            _applicationServiceCollection.AddInstance <IApplicationLifetime>(_applicationLifetime);
        }
Exemple #8
0
 public HostingEngine(
     [NotNull] IServiceCollection appServices, 
     [NotNull] IStartupLoader startupLoader, 
     [NotNull] IConfiguration config)
 {
     _config = config;
     _applicationServiceCollection = appServices;
     _startupLoader = startupLoader;
     _applicationLifetime = new ApplicationLifetime();
 }
Exemple #9
0
 public HostingEngine(
     [NotNull] IServiceCollection appServices,
     [NotNull] IStartupLoader startupLoader,
     [NotNull] IConfiguration config)
 {
     _config = config;
     _applicationServiceCollection = appServices;
     _startupLoader       = startupLoader;
     _applicationLifetime = new ApplicationLifetime();
 }
Exemple #10
0
        public void Run()
        {
            IApplicationBuilder application = serviceProvider.GetRequiredService <IApplicationBuilder>();
            IStartupLoader      start       = serviceProvider.GetRequiredService <IStartupLoader>();

            //注入中间件
            start.GetConfigureDelegate(startupType)();
            //注入服务
            start.GetConfigureServices(startupType)(serviceCollection);
            ITransferServer transfer =
                serviceProvider.GetRequiredService <IServerFactory>().Create();

            transfer.Start(new HostApplication(application.Build()));
        }
Exemple #11
0
 public TemporaryStartupLoadingControl()
 {
     InitializeComponent();
     StartupLoader = this.AssertViewModel <StartupLoadingVM>();
 }
 public IStartupLoader CreateStartupLoader(IStartupLoader next)
 {
     return(new StartupLoader(_services, next));
 }
 public DefaultLoader(IStartupLoader next)
 {
     _next = next ?? NullLoader.Instance;
 }
 public DefaultLoader()
 {
     _next = NullLoader.Instance;
 }
Exemple #15
0
 public async Task InitializeAESEngine(IStartupLoader sl)
 {
     DataUsage.safeReloadPlugins();
     SessionDetail.setSession();
 }