private void PromptRatingAtTheEndOfSongOrIfCanceled()
        {
            bool somethingIsPlaying = _config.ExternalConfig.ShowOnNewSong ||
                                      _config.State.Foobar2000IsPlayingRP ||
                                      _config.State.MusicBeeIsPlayingRP ||
                                      _config.IsRpPlayerTrackingChannel();

            var millisecsLeftToPrompt = (int)(_config.State.Playback.SongInfoExpiration - DateTime.Now).TotalMilliseconds - secondsBeforeSongEndsToPromptRating * 1000;

            if (_config.ExternalConfig.PromptForRating &&
                string.IsNullOrEmpty(_config.State.Playback.SongInfo.UserRating) &&
                somethingIsPlaying)
            {
                if (0 < millisecsLeftToPrompt && millisecsLeftToPrompt < 1000)
                {
                    _log.Information(LogHelper.GetMethodName(this), "Prompt at the end of song");
                }
                else if (1000 < millisecsLeftToPrompt && NextSongWaiterCancellationTokenSource.IsCancellationRequested)
                {
                    _log.Information(LogHelper.GetMethodName(this), "Prompt due to song cancellation");
                }
                else
                {
                    return;
                }
                _toastHandler.ShowSongRatingToast();
            }
        }
Esempio n. 2
0
        private void OnPromptForRatingChange()
        {
            // USER - menu button demonstration

            if (_config.ExternalConfig.PromptForRating)
            {
                _toastHandler.ShowSongRatingToast();
            }
        }