BeatMachine.ViewModel.PlayViewModel.LoadSongs C# (CSharp) Метод

LoadSongs() приватный Метод

private LoadSongs ( bool continuePlay ) : void
continuePlay bool
Результат void
        private void LoadSongs(bool continuePlay)
        {
            ThreadPool.QueueUserWorkItem(new WaitCallback(o =>
            {
                Group<AnalyzedSong> match = null;
                if (songs != null)
                {
                    match = songs
                        .Where(g => BPM - g.Key > 0 && BPM - g.Key < 10)
                        .FirstOrDefault();

                }

                if(match == null)
                {
                    DispatcherHelper.CheckBeginInvokeOnUI(() =>
                    {
                        HaveSongs = false;
                    });

                } else {
                    // Need to look up the actual MediaLibrary instances corresponding
                    // to the songs we have in the database
                    List<Song> mediaLibrarySongs = match.Items
                        .Select<AnalyzedSong, Song>(song => song.MediaLibrarySong)
                        .ToList();

                    BetterMediaPlayer p = new BetterMediaPlayer(mediaLibrarySongs);
                    p.PropertyChanged += Player_PropertyChanged;
                    DispatcherHelper.CheckBeginInvokeOnUI(() => {
                        if(Player != null)
                        {
                            Player.UnregisterEvents();
                        }
                        Player = p;
                        HaveSongs = true;
                        if (continuePlay)
                        {
                            Player.Play();
                        }
                    });
                }
            }));
        }