예제 #1
0
        private void frmPlaylists_Load(object sender, EventArgs e)
        {
            //Check whether global playlistmanager is empty or not
            if (Globals.GetInstance().PlaylistManager != null)
            {
                cachedPlayListManager = Globals.GetInstance().PlaylistManager;

                //Update the UI for playlist
                UpdatePlaylist(cachedPlayListManager);
            }
        }
예제 #2
0
        private void UpdatePlaylist(PlaylistManager playListManager)
        {
            try
            {
                //
                //This is the code which glues the PlaylistManager with UI
                //

                //Double check
                if (playListManager != null)
                {
                    foreach (Movie movie in playListManager.Movies)
                    {
                        //Create & add the movie node
                        TreeNode tnMovie = new TreeNode(movie.MovieName);

                        //Add the songs under movie
                        TreeNode tnMovieSong = null;
                        foreach (string key in movie.SongCollection)
                        {
                            //Create each song node
                            tnMovieSong = new TreeNode(movie.SongCollection[key]);

                            //Place the song id in associated Tag field
                            tnMovieSong.Tag = key;

                            //Add this to movie node
                            tnMovie.Nodes.Add(tnMovieSong);
                        }

                        //Add this to the root node
                        tvPlaylists.Nodes[0].Nodes.Add(tnMovie);

                    }

                }

            }
            catch(Exception ex)
            {
                frmException frm = new frmException();
                frm.ExceptionDialogTitle = "frmPlaylists::UpdatePlaylist - Error while updating the playlist ";
                frm.ErrorMessage = ex.Message;
                frm.StrackTrace = ex.StackTrace;
                if (frm.ShowDialog() == DialogResult.OK)
                {
                    frm.Dispose();
                    frm = null;
                }
            }
        }