示例#1
0
        private async Task StartAppServices(StartCommandContext context)
        {
            foreach (var appInstallation in context.AppInstallations)
            {
                _log.InfoFormat(Resources.StartCommandHandler_StartAppService, appInstallation);

                // Запуск рабочего процесса приложения
                await _appService.Start(appInstallation, context.CommandOptions.Timeout);
            }
        }
示例#2
0
        private Task FindAppInstallations(StartCommandContext 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.StartCommandHandler_CanNotFindAnyApplicationsToStart);
            }

            return(AsyncHelper.EmptyTask);
        }
示例#3
0
        public override async Task Handle(StartCommandOptions options)
        {
            CommonHelper.CheckAdministrativePrivileges();

            var commandContext = new StartCommandContext
            {
                CommandOptions = options
            };

            var commandTransaction = new CommandTransactionManager <StartCommandContext>(_log)
                                     .Stage(Resources.StartCommandHandler_FindAppInstallations, FindAppInstallations)
                                     .Stage(Resources.StartCommandHandler_StartAppServices, StartAppServices);

            await commandTransaction.Execute(commandContext);
        }