/// <summary> /// Play from the file path. /// </summary> /// <param name="path">The path of music file</param> private bool Play(string path) { Player.Stop(); if (File.Exists(path)) { Player.Source = new Uri(path); Player.Play(); State = PlayState.PLAY; timer.Start(); PlayIcon.Kind = MaterialDesignThemes.Wpf.PackIconKind.Pause; return(true); } else { // Path doesn't exist, find from List and remove it. var index = Musics.ToList().FindIndex(a => a.Path.Equals(path)); if (index != -1) { Musics.RemoveAt(index); SaveMusicList(); } return(false); } }