Esempio n. 1
0
        public async Task HandleAsync(DomainCommandContext context, InitializeCommand command)
        {
            var applicationSettings = await _applicationSettingsRepository.LoadAsync();

            var games = await _gameRepository.LoadAllAsync();

            var gameProfileId = await _gameRepository.LoadGameProfileIdAsync();

            var textureManagementSettings = await _textureManagementSettingsRepository.LoadAsync();

            var usageStatistics = await _usageStatisticsRepository.LoadAsync();

            var @event = new InitializeEvent(
                applicationSettings.Map <ApplicationSettings>(),
                games.Map <IEnumerable <Game> >(),
                gameProfileId?.Value,
                textureManagementSettings.Map <TextureManagementSettings>(),
                usageStatistics.Map <SharedModel.UsageStatistics>());

            foreach (var settings in games)
            {
                await _processWatcher.WatchAsync(settings.Id);
            }

            await context.PublishAsync(@event);
        }
Esempio n. 2
0
        public async Task HandleAsync(DomainCommandContext context, UpdateApplicationSettingsCommand command)
        {
            var applicationSettings = await _applicationSettingsRepository.LoadAsync();

            applicationSettings.ApplicationCommunicationPort = command.ApplicationCommunicationPort;
            applicationSettings.ProxyCommunicationPort       = command.ProxyCommunicationPort;

            await _applicationSettingsRepository.SaveAsync(applicationSettings);

            await context.PublishAsync(new ApplicationSettingsUpdatedEvent(command.ApplicationCommunicationPort, command.ProxyCommunicationPort));
        }