Пример #1
0
        public SongElement AddElement(Source.Music.Track t)
        {
            SongElement se = new SongElement()
            {
                Author = t.Author,
                name   = t.Title,
                Track  = t,
                Length = t.Length,
            };

            return(se);
        }
Пример #2
0
 public void AddElement(Source.Music.Track Track)
 {
     UI.Controls.SongElement se = new Controls.SongElement()
     {
         Author = Track.Author,
         Length = Track.Length,
         name   = Track.Title,
         Track  = Track,
         Added  = AddedToText(Track.DateOfAdding),
     };
     StackPanel.Children.Add(se);
 }
Пример #3
0
        private void CreateSongElement(List <string> files)
        {
            string[] data;
            string   title  = "";
            string   author = "";
            List <Source.Music.Track> tracks  = new List <Source.Music.Track>();
            List <Source.Music.Track> already = References.trackCollection.Tracks;
            int    i      = already.Count;
            string length = "";

            foreach (string s in files)
            {
                if (already.Where(c => c.Path == s).Any())
                {
                    continue;
                }
                data   = GetName(s);
                title  = data[1];
                author = data[0];
                length = GetLength(s);

                Source.Music.Track tr = new Source.Music.Track();
                References.trackCollection.Tracks.Add(tr);
                tr.Path         = s;
                tr.Length       = length;
                tr.ID           = (uint)i;
                tr.Title        = title;
                tr.Author       = author;
                tr.DateOfAdding = DateTime.Now;
                tr.LengthDouble = GetLengthToDouble(s);
                tracks.Add(tr);
                UI.Controls.SongElement se = new Controls.SongElement()
                {
                    name   = title,
                    Author = author,
                    Length = length,
                    Track  = tr,
                };
                StackPanel.Children.Add(se);
                i++;
            }

            Source.Music.TrackData.AddTrack(tracks);
        }