private void Page_CloseRequested(object sender, SystemNavigationCloseRequestedPreviewEventArgs e) { PlayingService.Volume = myMainPage._mediaPlayer.Volume; PlayingService.Save(); if (myMainPage == null || PlayingService.PlayDurationStopwatch == null) { return; } myMainPage.playDurationStopwatch.Stop(); if (PlayingService.PlayingSong == null) { return; } System.Threading.Tasks.Task.Run(() => SongService.MarkPlayDuration(PlayingService.PlayingSong.Id, PlayingService.PlayingListId, PlayingService.PlayDurationStopwatch.ElapsedMilliseconds / 1000)); }