/// <summary> /// Shows the playlist and adds song buttons. /// </summary> public void ShowPlaylist() { mySongPanel.Children.Clear(); foreach (Song song in mySongs) { SongButton.Create(song, mySongPanel, myMainWindow, myGUIHander, this); } }
/// <summary> /// Creates a button for a song. /// </summary> /// <param name="aSong"></param> /// <param name="aPanel"></param> /// <param name="aMainWindow"></param> /// <param name="aHandler"></param> /// <param name="aPlaylist"></param> /// <returns></returns> public static SongButton Create(Song aSong, StackPanel aPanel, MainWindow aMainWindow, GUIHandler aHandler, Playlist aPlaylist) { SongButton songButton = new SongButton(aSong, aPanel, aMainWindow, aHandler, aPlaylist); Button tempButton = new Button(); tempButton.Width = 880; tempButton.Height = 25; tempButton.Content = aSong.AccessName; tempButton.VerticalAlignment = VerticalAlignment.Top; ContextMenu menu = new ContextMenu(); MenuItem items = new MenuItem(); items.Header = "Add to playlist"; menu.Items.Add(items); tempButton.ContextMenu = menu; items.Click += songButton.ContextAddToPlaylist; aPanel.Children.Add(tempButton); tempButton.Click += songButton.SongClicked; return(songButton); }