Пример #1
0
        /// <summary>
        /// Intialiser for home page
        /// </summary>
        public HomePage()
        {
            InitializeComponent();

            // Sets up form components
            musicPlayer = new frmMusicPlayer(this);
            playlists = new ViewUserPlaylists();
            searchResults = new SearchResults(musicPlayer, this);
            profileScreen = new UserProfile();
            viewPlaylist = new ViewPlaylist();
            weatherPage = new WeatherPage(this.currentUser, this);
        }
Пример #2
0
 private void cmdGetPlaylists_Click(object sender, EventArgs e)
 {
     ViewUserPlaylists playlists = new ViewUserPlaylists();
     playlists.currentUser = Microsoft.VisualBasic.Interaction.InputBox("Which user do you want playlists for?", "Select User");
     playlists.Show();
 }
Пример #3
0
        //Method to load the search window
        private void btnSearch_Click(object sender, EventArgs e)
        {
            hideForms();

            //Get user search text
            String searchText = txtSearchBox.Text;

            //Create a new song model
            SongModel songModel = new SongModel();
            PlaylistModel playlistModel = new PlaylistModel();

            //Populate song list with songs that fit the criteria
            List<Song> songs = new List<Song>();
            Thread songThread = new Thread(() => { songs = songModel.searchSongs(searchText); });
            songThread.Start();

            //Populate artist list with artists that fir the criteria
            List<String> artists = new List<String>();
            Thread artistThread = new Thread(() => { artists = songModel.searchArtists(searchText.ToLower()); });
            artistThread.Start();

            //Populate artist list with artists that fir the criteria
            List<Playlist> playlists = new List<Playlist>();
            Thread playlistThread = new Thread(() => { playlists = playlistModel.searchPlaylists(searchText); });
            playlistThread.Start();

            //Join threads
            songThread.Join();
            artistThread.Join();
            playlistThread.Join();

            //Call method to load results window
            loadSearchResults(songs, artists, playlists, searchText);
        }