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); } }
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); }
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); }