예제 #1
0
        private async Task StartAppInitialization(InitCommandContext context)
        {
            foreach (var appInstallation in context.AppInstallations)
            {
                _log.InfoFormat(Resources.InitCommandHandler_StartInitialization, appInstallation);

                // Запуск рабочего процесса приложения
                await _appService.Init(appInstallation, context.CommandOptions.Timeout);
            }
        }
예제 #2
0
        private Task FindAppInstallations(InitCommandContext context)
        {
            context.AppInstallations = _installDirectory.GetItems(context.CommandOptions.Id, context.CommandOptions.Version, context.CommandOptions.Instance);

            if ((context.AppInstallations == null) || (context.AppInstallations.Length <= 0))
            {
                throw new CommandHandlerException(Resources.InitCommandHandler_CanNotFindAnyApplicationsToStart);
            }

            return(AsyncHelper.EmptyTask);
        }
예제 #3
0
        public override async Task Handle(InitCommandOptions options)
        {
            CommonHelper.CheckAdministrativePrivileges();

            var commandContext = new InitCommandContext
            {
                CommandOptions = options
            };

            var commandTransaction = new CommandTransactionManager <InitCommandContext>(_log)
                                     .Stage(Resources.InitCommandHandler_FindAppInstallations, FindAppInstallations)
                                     .Stage(Resources.InitCommandHandler_StartAppInitialization, StartAppInitialization);

            await commandTransaction.Execute(commandContext);
        }