internal async Task PlayAsync() { Finished = false; playingAsync = true; await Task.Run(() => { try { double lenMs = SoundInfo.GetWavLengthMs(fileName); DateTime stopAt = DateTime.Now.AddMilliseconds(lenMs); this.Play(); while (DateTime.Now < stopAt) { cancellationToken.ThrowIfCancellationRequested(); //The delay helps reduce processor usage while "spinning" Task.Delay(10).Wait(); } } catch (OperationCanceledException) { base.Stop(); ResetTokenSource(); } finally { OnSoundFinished(); } }, cancellationToken); }