예제 #1
0
        async Task <bool> IPrepareSong.PrepareSongAsync(Action changePropertyMethod, IBaseSong currentSong, int resumeAt)
        {
            _mP3.StopPlay();
            string paths = currentSong.FullPath;

            if (IsMp3(paths) == false)
            {
                string OldPath = currentSong.FullPath;
                paths = ConvertToMp3(currentSong.FullPath);
                await RenameFileAsync(OldPath, paths);
            }
            if (FileExists(paths) == false)
            {
                if (ShowErrors == true)
                {
                    UIPlatform.ShowError($"Cannot find the path {paths}  when trying to play a song.  Maybe the hard drive is having problems or you have been disconnected from the network");
                    return(false);
                }
            }
            changePropertyMethod.Invoke();
            _mP3.Path = paths;
            if (resumeAt == 0)
            {
                await _mP3.PlayAsync();
            }
            else
            {
                await _mP3.PlayAsync(resumeAt);
            }
            return(true);
        }
 public NewSongEventModel(IBaseSong currentSong, int resumeAt)
 {
     CurrentSong = currentSong;
     ResumeAt    = resumeAt;
 }
예제 #3
0
 public static Task PlayNewSongAsync(this IBaseSong song, int resumeAt)
 {
     return(Aggregator !.PublishAsync(new NewSongEventModel(song, resumeAt)));
 }