/// <summary> /// Stops any currently playing <see cref="PreviewTrack"/>. /// </summary> /// <remarks> /// Only the immediate owner (an object that implements <see cref="IPreviewTrackOwner"/>) of the playing <see cref="PreviewTrack"/> /// can globally stop the currently playing <see cref="PreviewTrack"/>. The object holding a reference to the <see cref="PreviewTrack"/> /// can always stop the <see cref="PreviewTrack"/> themselves through <see cref="PreviewTrack.Stop()"/>. /// </remarks> /// <param name="source">The <see cref="IPreviewTrackOwner"/> which may be the owner of the <see cref="PreviewTrack"/>.</param> public void StopAnyPlaying(IPreviewTrackOwner source) { if (current == null || current.Owner != source) { return; } current.Stop(); current = null; }
/// <summary> /// Stops any currently playing <see cref="PreviewTrack"/>. /// </summary> /// <remarks> /// Only the immediate owner (an object that implements <see cref="IPreviewTrackOwner"/>) of the playing <see cref="PreviewTrack"/> /// can globally stop the currently playing <see cref="PreviewTrack"/>. The object holding a reference to the <see cref="PreviewTrack"/> /// can always stop the <see cref="PreviewTrack"/> themselves through <see cref="PreviewTrack.Stop()"/>. /// </remarks> /// <param name="source">The <see cref="IPreviewTrackOwner"/> which may be the owner of the <see cref="PreviewTrack"/>.</param> public void StopAnyPlaying(IPreviewTrackOwner source) { if (CurrentTrack == null || (CurrentTrack.Owner != null && CurrentTrack.Owner != source)) { return; } CurrentTrack.Stop(); // CurrentTrack should not be set to null here as it will result in incorrect handling in the track.Stopped callback above. }
private void load(IPreviewTrackOwner owner) { Owner = owner; }