private void StartTrackTimer(TrackModel selectedMusic) { if (selectedMusic.DurationSec == null) { Duration = StringFormatter.DurationFormat(selectedMusic.DurationMillisec); MaxProgressValue = Convert.ToDouble(selectedMusic.DurationMillisec); Device.StartTimer(TimeSpan.FromSeconds(0.2), () => { ProgressValue = (double)audioService.CurrentTrackProgressPosition(); Position = StringFormatter.DurationFormat(audioService.CurrentTrackProgressPosition().ToString()); return(true); }); } else { MaxProgressValue = Convert.ToDouble(selectedMusic.DurationSec); Duration = StringFormatter.DurationFormat((MaxProgressValue * 1000).ToString()); Device.StartTimer(TimeSpan.FromSeconds(0.2), () => { ProgressValue = (double)audioService.CurrentTrackProgressPosition(); Position = StringFormatter.DurationFormat((audioService.CurrentTrackProgressPosition() * 1000).ToString()); return(true); }); } }