Пример #1
0
        private async Task NextTrack()
        {
            using (IServiceScope scope = _serviceProvider.CreateScope())
            {
                IChannelTrackRepository channelTrackRepository = scope.ServiceProvider.GetService <IChannelTrackRepository>();

                await channelTrackRepository.MoveToNextTrack(_currentChannel);

                _currentTrack = channelTrackRepository.CurrentChannelTrackFor(_currentChannel).Track;

                await _radioHubProxy.UpdateTrack(_currentChannel, _currentTrack);
            }

            _timer.Stop();
            _timer.Interval = _currentTrack.Length.TotalMilliseconds;
            _timer.Start();
            _stopwatch.Restart();
        }
Пример #2
0
        private async Task NextTrack()
        {
            _timer.Stop();
            _stopwatch.Stop();

            using (IServiceScope scope = _serviceProvider.CreateScope())
            {
                IChannelTrackRepository channelTrackRepository = scope.ServiceProvider.GetService <IChannelTrackRepository>();

                Track track = await channelTrackRepository.MoveToNextTrack(_channelId);

                _trackId        = track.Id;
                _timer.Interval = track.Length.TotalMilliseconds;
            }

            await _radioHubProxy.UpdateTrack(_channelId, _trackId);

            _timer.Start();
            _stopwatch.Restart();
        }