private async void Player_MediaEnded(object sender, MediaEndedEventArgs e) { var lastPlayingSong = Player.CurrentlyPlayingFile; if (Repeat == "Repeat List") { PlayNext(); } else { await SharedLogic.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { //DontUpdatePosition = true; //CurrentPosition = 0; //Player.PlayerState = Repeat == "Repeat Song" ? PlayerState.Stopped : PlayerState.Playing; if (Repeat == "No Repeat" && GetPlayingCollection() != null && GetPlayingCollection().Any()) { PlayNext(); } //else // PlayPause(); }); } await SharedLogic.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async() => { lastPlayingSong.PlayCount++; lastPlayingSong.LastPlayed = DateTime.Now.ToString(CultureInfo.CurrentCulture); TracksCollection.Elements.First(T => T.Path == lastPlayingSong.Path).PlayCount++; TracksCollection.Elements.First(T => T.Path == lastPlayingSong.Path).LastPlayed = DateTime.Now.ToString(); await _service.UpdateMediafile(lastPlayingSong); await ScrobblePlayingSong(); }); }
private async void Player_MediaEnded(object sender, MediaEndedEventArgs e) { var lastPlayingSong = Player.CurrentlyPlayingFile; if (Repeat == "Repeat List") { PlayNext(); } else { await BreadDispatcher.InvokeAsync(() => { DontUpdatePosition = true; CurrentPosition = 0; Player.PlayerState = Repeat == "Repeat Song" ? PlayerState.Stopped : PlayerState.Playing; if (Repeat == "No Repeat" && GetPlayingCollection() != null && GetPlayingCollection().Any()) { PlayNext(); } else { PlayPause(); } }); } await BreadDispatcher.InvokeAsync(async() => { if (TracksCollection.Elements.Any(t => t.Path == lastPlayingSong.Path)) { lastPlayingSong.PlayCount++; lastPlayingSong.LastPlayed = DateTime.Now; TracksCollection.Elements.First(T => T.Path == lastPlayingSong.Path).PlayCount++; TracksCollection.Elements.First(T => T.Path == lastPlayingSong.Path).LastPlayed = DateTime.Now; await _service.UpdateMediafile(lastPlayingSong); } await ScrobblePlayingSong(lastPlayingSong); }); }