示例#1
0
        private void GetData()
        {
            List <string> mylist = (List <string>)DependencyService.Get <IMyfile>().GetFileLocation();

            try
            {
                playlistManager.GetAllSongs(songs);
                //string artists = "";
                //songs.Clear();
                //for (int i = 0; i < mylist.Count; i++)
                //{
                //    var tfile = TagLib.File.Create(mylist[i]);
                //    artists = "";
                //    for (int c = 0; c < tfile.Tag.Artists.Count(); c++)
                //    {
                //        artists = artists + tfile.Tag.Artists[c];
                //    }
                //    Song song = new Song(tfile.Tag.Pictures[0].Data.Count)
                //    {
                //        Album = tfile.Tag.Album,
                //        Index = i,
                //        Artist = artists,
                //        Duration = tfile.Properties.Duration.ToString().Substring(4, 4),
                //        Img = tfile.Tag.Pictures[0].Data.ToArray(),
                //        Title = tfile.Tag.Title,
                //        Path = mylist[i]
                //    };
                //    songs.Add(song);
                //}

                //MainCollectionView.ItemsSource = songs;
                //string jsondata = Newtonsoft.Json.JsonConvert.SerializeObject(songs);
                //System.IO.File.WriteAllText(Path.Combine(FileSystem.AppDataDirectory, "SongsData"), jsondata);
            }
            catch (Exception t)
            {
            }


            //var listView = new ListView();
            //if (mylist != null)
            //{
            //    //listView.ItemsSource = mylist;
            //}

            //Content = listView;
        }