Пример #1
0
 public static async void AddSong(Song song)
 {
     JObject songItem = new JObject(new JProperty("songid", song.SongId));
     await Playlist.Add(PlayelistType.Audio, songItem);
 }
Пример #2
0
 public static async Task PlaySong(Song song)
 {
     GlobalVariables.CurrentTracker.SendEvent(EventCategories.Programmatic, EventActions.Play, EventNames.PlaySong, 0);
     JObject songToOpen = new JObject(new JProperty("songid", song.SongId));
     await Player.Open(songToOpen);
 }
        private async void FileItemWrapper_Tapped(object sender, TappedRoutedEventArgs e)
        {
            var file = (File)((FrameworkElement)sender).DataContext;
            if (file.FileType == "directory")
            {
                LoadDirectory(file);
            }
            else
            {
                var fileDetails = await RPCWrappers.Files.GetFileDetails(file.Path, GlobalVariables.CurrentSource.Media);

                switch (fileDetails.Type)
                {
                    case "music":
                        var song = new Song { SongId = fileDetails.Id };
                        await Player.PlaySong(song);
                        break;
                    case "movie":
                        var movie = new Movie { MovieId = fileDetails.Id };
                        Player.PlayMovie(movie);
                        break;
                    case "episode":
                        var episode = new Episode { EpisodeId = fileDetails.Id };
                        Player.PlayEpidose(episode);
                        break;
                }
            }
        }