Example #1
0
        /// <summary>
        /// Reports the playback completed.
        /// </summary>
        /// <param name="eventArgs">The <see cref="PlaybackStopEventArgs"/> instance containing the event data.</param>
        public async void ReportPlaybackCompleted(PlaybackStopEventArgs eventArgs)
        {
            lock (_reporterLock)
            {
                if (_reporter != null)
                {
                    _reporter.Dispose();
                    _reporter = null;
                }
            }

            await _presentationManager.Window.Dispatcher.InvokeAsync(() => _presentationManager.WindowOverlay.SetResourceReference(FrameworkElement.StyleProperty, "WindowBackgroundContent"));

            EventHelper.QueueEventIfNotNull(PlaybackCompleted, this, eventArgs, _logger);
        }
Example #2
0
        /// <summary>
        /// Called when [playback started].
        /// </summary>
        /// <param name="player">The player.</param>
        /// <param name="options">The options.</param>
        private async void OnPlaybackStarted(IMediaPlayer player, PlayOptions options)
        {
            EventHelper.QueueEventIfNotNull(PlaybackStarted, this, new PlaybackStartEventArgs
            {
                Options = options,
                Player  = player
            }, _logger);

            lock (_reporterLock)
            {
                if (_reporter != null)
                {
                    _reporter.Dispose();
                    _reporter = null;
                }
            }

            _reporter = new PlaybackProgressReporter(_apiClient, player, _logger, this);
            await _reporter.Start().ConfigureAwait(false);
        }
Example #3
0
        /// <summary>
        /// Reports the playback completed.
        /// </summary>
        /// <param name="eventArgs">The <see cref="PlaybackStopEventArgs"/> instance containing the event data.</param>
        public async Task ReportPlaybackCompleted(PlaybackStopEventArgs eventArgs)
        {
            lock (_reporterLock)
            {
                if (_reporter != null)
                {
                    _reporter.Dispose();
                    _reporter = null;
                }
            }

            await _presentationManager.Window.Dispatcher.InvokeAsync(() => _presentationManager.WindowOverlay.SetResourceReference(FrameworkElement.StyleProperty, "WindowBackgroundContent"));

            EventHelper.QueueEventIfNotNull(PlaybackCompleted, this, eventArgs, _logger);
        }
Example #4
0
        /// <summary>
        /// Called when [playback started].
        /// </summary>
        /// <param name="player">The player.</param>
        /// <param name="options">The options.</param>
        private async void OnPlaybackStarted(IMediaPlayer player, PlayOptions options)
        {
            EventHelper.QueueEventIfNotNull(PlaybackStarted, this, new PlaybackStartEventArgs
            {
                Options = options,
                Player = player
            }, _logger);

            lock (_reporterLock)
            {
                if (_reporter != null)
                {
                    _reporter.Dispose();
                    _reporter = null;
                }
            }

            _reporter = new PlaybackProgressReporter(_connectionManager, player, _logger, this, _apiPlaybackManager);
            await _reporter.Start().ConfigureAwait(false);
        }