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, IndicateFirstLaunchCommand command)
        {
            var usageStatistics = await _usageStatisticsRepository.LoadAsync();

            usageStatistics.FirstLaunchTime = command.Time;

            await _usageStatisticsRepository.SaveAsync(usageStatistics);

            await context.PublishAsync(new FirstLaunchIndicatedEvent(command.Time));
        }