Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 5
0
 public StartupLoader(
     IServiceProvider services,
     IStartupLoader next)
 {
     _services = services;
     _next     = next;
 }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 8
0
 public HostingEngine(
     [NotNull] IServiceCollection appServices, 
     [NotNull] IStartupLoader startupLoader, 
     [NotNull] IConfiguration config)
 {
     _config = config;
     _applicationServiceCollection = appServices;
     _startupLoader = startupLoader;
     _applicationLifetime = new ApplicationLifetime();
 }
Ejemplo n.º 9
0
 public HostingEngine(
     [NotNull] IServiceCollection appServices,
     [NotNull] IStartupLoader startupLoader,
     [NotNull] IConfiguration config)
 {
     _config = config;
     _applicationServiceCollection = appServices;
     _startupLoader       = startupLoader;
     _applicationLifetime = new ApplicationLifetime();
 }
Ejemplo n.º 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()));
        }
Ejemplo n.º 11
0
 public TemporaryStartupLoadingControl()
 {
     InitializeComponent();
     StartupLoader = this.AssertViewModel <StartupLoadingVM>();
 }
Ejemplo n.º 12
0
 public IStartupLoader CreateStartupLoader(IStartupLoader next)
 {
     return(new StartupLoader(_services, next));
 }
Ejemplo n.º 13
0
 public DefaultLoader(IStartupLoader next)
 {
     _next = next ?? NullLoader.Instance;
 }
Ejemplo n.º 14
0
 public DefaultLoader()
 {
     _next = NullLoader.Instance;
 }
Ejemplo n.º 15
0
 public async Task InitializeAESEngine(IStartupLoader sl)
 {
     DataUsage.safeReloadPlugins();
     SessionDetail.setSession();
 }