Пример #1
0
        public void showAllChangedPlayListTracks()
        {
            var playListName = (PlayListBox).SelectedItems.Cast <string>().FirstOrDefault();
            var playList     = Settings.playLists.Where(x => x.Name == playListName).FirstOrDefault();

            if (playList != null)
            {
                Player.Stop();

                counter  = 0;
                playlist = playListName;
                if (playList.songsList.Count == 0)
                {
                    flowLayoutPanel1.Controls.Clear(); return;
                }

                trackName = playList.songsList[0];

                playAudio(trackName);

                flowLayoutPanel1.Controls.Clear();

                if (playList != null)
                {
                    foreach (var song in playList.songsList)
                    {
                        var m = new TrackModel(song)
                        {
                            Margin = new Padding(14, 5, 0, 0),
                            Dock   = DockStyle.None
                        };

                        flowLayoutPanel1.Controls.Add(m);
                    }
                }
                else
                {
                    flowLayoutPanel1.Controls.Clear();
                }
            }
            else
            {
                flowLayoutPanel1.Controls.Clear();
            }
        }
Пример #2
0
        public void showAllTracks()
        {
            if (Settings.songsList.Count != 0)
            {
                playlist  = default;
                counter   = 0;
                trackName = Settings.songsList[0];
                flowLayoutPanel1.Controls.Clear();
                bool remove = true;
                foreach (var song in Settings.songsList)
                {
                    var file = new FileInfo(song);
                    if (file.Exists)
                    {
                        var m = new TrackModel(song)
                        {
                            Margin = new Padding(14, 5, 0, 0),
                            Dock   = DockStyle.None
                        };
                        remove = false;
                        flowLayoutPanel1.Controls.Add(m);
                    }
                }
                if (remove)
                {
                    Settings.songsList = Settings.songsList.Where(x => (new FileInfo(x).Exists)).ToList();

                    foreach (var el in Settings.playLists)
                    {
                        if (el.songsList.Contains(trackName))
                        {
                            el.songsList.Remove(trackName);
                        }
                    }
                    saveChanges();
                }
            }
        }