private async Task UpdateAction() { while (true) { try { using (PlayingInfo currentInfo = await GetCurrent()) if (!Object.Equals(currentInfo, _prevInfo)) { _prevInfo = currentInfo; PlayingInfoChanged?.Invoke(this, new PlayingEventArgs(currentInfo)); } await Task.Delay(UpdateTimeoutMs); await _updateSync.WaitAsync(); } catch { // doesn't matter if we got an exception here. } } }
private void ProviderOnPlayingInfoChanged(object sender, PlayingEventArgs e) { PlayingInfoChanged?.Invoke(this, e); }