Closed ben-xo closed 6 years ago
I'm unable to re-produce this. The enabling state is defined by what the Scrobber is told is the currently playing media from a plugin:
`
private void TrayMenu_Opening(object sender, System.ComponentModel.CancelEventArgs e)
{
string trackName = _currentMediaItem?.TrackName ?? "
mnuShow.Enabled = this.WindowState == FormWindowState.Minimized || this.Visible == false;
mnuLoveThisTrack.Enabled = _currentMediaItem != null && _currentUser != null;
if (_currentMediaItem != null)
{
if ((LoveStatus)stripLoveTrack.Tag == LoveStatus.Love)
{
mnuLoveThisTrack.Text = string.Format(LocalizationStrings.NotificationThread_TrayMenu_LoveTrack, trackName);
}
else if ((LoveStatus)stripLoveTrack.Tag == LoveStatus.Unlove)
{
mnuLoveThisTrack.Text = string.Format(LocalizationStrings.NotificationThread_TrayMenu_Un_Love, trackName);
}
}
else
{
mnuLoveThisTrack.Text = LocalizationStrings.NotificationThread_TrayMenu_Love_this_Track;
}
mnuEnableScrobbling.Checked = ScrobbleFactory.ScrobblingEnabled;
mnuViewUserProfile.Enabled = !string.IsNullOrEmpty(_currentUser?.Url);
}`
There's only one scenario where I can think that might happen, and that's if a track ends (or is due to end) on the next iTunes plugin cycle (with iTunes a cycle is every 7 seconds) a notification is sent to stipulate that nothing is playing, and then on the next cycle the now playing notification is sent.
Steps to reproduce:
It also sometimes works if you do it in the opposite order (pause WMP first, play in iTunes)
I'll test this scenario tonight, but I was able to reproduce it using a media keyboard with just WMP open and the tray menu open. I've pushed a fix up so you can try it now, and close this when I'm happy it's fixed.
Scenarios tested.
Caveat, I forgot to mention: The enabling / disabling / refresh state of the menu item is solely dependent on the timing of the relevant scrobbler. Meaning, with iTunes the menu is at it's earliest refreshed within 7 seconds. With there now being proper tracking at the Ui level of Started/Stopped this means the menu is now only refreshed twice per track.
Expected: "love" item re-enables when a track is playing