Redesigned and fixed Playlist Maker
This commit is contained in:
+2
-2
@@ -317,8 +317,8 @@
|
||||
// makeToolStripMenuItem
|
||||
//
|
||||
this.makeToolStripMenuItem.Name = "makeToolStripMenuItem";
|
||||
this.makeToolStripMenuItem.Size = new System.Drawing.Size(103, 22);
|
||||
this.makeToolStripMenuItem.Text = "Make";
|
||||
this.makeToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
this.makeToolStripMenuItem.Text = "Create / Edit";
|
||||
this.makeToolStripMenuItem.Click += new System.EventHandler(this.makeToolStripMenuItem_Click);
|
||||
//
|
||||
// ControlsPanel
|
||||
|
||||
+60
-11
@@ -36,12 +36,16 @@ namespace MusicPlayer
|
||||
this.PlaylistSongContainer = new System.Windows.Forms.ListBox();
|
||||
this.PlaylistNewButton = new System.Windows.Forms.Button();
|
||||
this.PlaylistNewInputfield = new System.Windows.Forms.TextBox();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// PlaylistSelectBox
|
||||
//
|
||||
this.PlaylistSelectBox.FormattingEnabled = true;
|
||||
this.PlaylistSelectBox.Location = new System.Drawing.Point(12, 12);
|
||||
this.PlaylistSelectBox.Location = new System.Drawing.Point(10, 96);
|
||||
this.PlaylistSelectBox.Name = "PlaylistSelectBox";
|
||||
this.PlaylistSelectBox.Size = new System.Drawing.Size(354, 21);
|
||||
this.PlaylistSelectBox.TabIndex = 0;
|
||||
@@ -50,33 +54,33 @@ namespace MusicPlayer
|
||||
// PlaylistSongSelector
|
||||
//
|
||||
this.PlaylistSongSelector.FormattingEnabled = true;
|
||||
this.PlaylistSongSelector.Location = new System.Drawing.Point(13, 39);
|
||||
this.PlaylistSongSelector.Location = new System.Drawing.Point(11, 149);
|
||||
this.PlaylistSongSelector.Name = "PlaylistSongSelector";
|
||||
this.PlaylistSongSelector.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended;
|
||||
this.PlaylistSongSelector.Size = new System.Drawing.Size(353, 160);
|
||||
this.PlaylistSongSelector.Size = new System.Drawing.Size(353, 121);
|
||||
this.PlaylistSongSelector.TabIndex = 1;
|
||||
//
|
||||
// PlaylistAddSongsButton
|
||||
//
|
||||
this.PlaylistAddSongsButton.Location = new System.Drawing.Point(12, 293);
|
||||
this.PlaylistAddSongsButton.Location = new System.Drawing.Point(10, 276);
|
||||
this.PlaylistAddSongsButton.Name = "PlaylistAddSongsButton";
|
||||
this.PlaylistAddSongsButton.Size = new System.Drawing.Size(354, 23);
|
||||
this.PlaylistAddSongsButton.TabIndex = 2;
|
||||
this.PlaylistAddSongsButton.Text = "Add";
|
||||
this.PlaylistAddSongsButton.Text = "Add selected to playlist";
|
||||
this.PlaylistAddSongsButton.UseVisualStyleBackColor = true;
|
||||
this.PlaylistAddSongsButton.Click += new System.EventHandler(this.PlaylistAddSongsButton_Click);
|
||||
//
|
||||
// PlaylistSongContainer
|
||||
//
|
||||
this.PlaylistSongContainer.FormattingEnabled = true;
|
||||
this.PlaylistSongContainer.Location = new System.Drawing.Point(12, 205);
|
||||
this.PlaylistSongContainer.Location = new System.Drawing.Point(10, 327);
|
||||
this.PlaylistSongContainer.Name = "PlaylistSongContainer";
|
||||
this.PlaylistSongContainer.Size = new System.Drawing.Size(354, 82);
|
||||
this.PlaylistSongContainer.TabIndex = 3;
|
||||
//
|
||||
// PlaylistNewButton
|
||||
//
|
||||
this.PlaylistNewButton.Location = new System.Drawing.Point(118, 342);
|
||||
this.PlaylistNewButton.Location = new System.Drawing.Point(290, 23);
|
||||
this.PlaylistNewButton.Name = "PlaylistNewButton";
|
||||
this.PlaylistNewButton.Size = new System.Drawing.Size(75, 23);
|
||||
this.PlaylistNewButton.TabIndex = 4;
|
||||
@@ -86,16 +90,56 @@ namespace MusicPlayer
|
||||
//
|
||||
// PlaylistNewInputfield
|
||||
//
|
||||
this.PlaylistNewInputfield.Location = new System.Drawing.Point(12, 342);
|
||||
this.PlaylistNewInputfield.Location = new System.Drawing.Point(11, 25);
|
||||
this.PlaylistNewInputfield.Name = "PlaylistNewInputfield";
|
||||
this.PlaylistNewInputfield.Size = new System.Drawing.Size(100, 20);
|
||||
this.PlaylistNewInputfield.Size = new System.Drawing.Size(273, 20);
|
||||
this.PlaylistNewInputfield.TabIndex = 5;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(12, 9);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(95, 13);
|
||||
this.label1.TabIndex = 6;
|
||||
this.label1.Text = "Create new playlist";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(10, 80);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(97, 13);
|
||||
this.label2.TabIndex = 7;
|
||||
this.label2.Text = "Edit existing playlist";
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(7, 311);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(82, 13);
|
||||
this.label3.TabIndex = 8;
|
||||
this.label3.Text = "Songs in playlist";
|
||||
//
|
||||
// label4
|
||||
//
|
||||
this.label4.AutoSize = true;
|
||||
this.label4.Location = new System.Drawing.Point(11, 130);
|
||||
this.label4.Name = "label4";
|
||||
this.label4.Size = new System.Drawing.Size(49, 13);
|
||||
this.label4.TabIndex = 9;
|
||||
this.label4.Text = "All songs";
|
||||
//
|
||||
// PlaylistMaker
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(382, 400);
|
||||
this.ClientSize = new System.Drawing.Size(382, 419);
|
||||
this.Controls.Add(this.label4);
|
||||
this.Controls.Add(this.label3);
|
||||
this.Controls.Add(this.label2);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.PlaylistNewInputfield);
|
||||
this.Controls.Add(this.PlaylistNewButton);
|
||||
this.Controls.Add(this.PlaylistSongContainer);
|
||||
@@ -103,7 +147,8 @@ namespace MusicPlayer
|
||||
this.Controls.Add(this.PlaylistSongSelector);
|
||||
this.Controls.Add(this.PlaylistSelectBox);
|
||||
this.Name = "PlaylistMaker";
|
||||
this.Text = "PlaylistMaker";
|
||||
this.Text = "Create / Edit playlists";
|
||||
this.Shown += new System.EventHandler(this.PlaylistMaker_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
@@ -117,5 +162,9 @@ namespace MusicPlayer
|
||||
private System.Windows.Forms.ListBox PlaylistSongContainer;
|
||||
private Button PlaylistNewButton;
|
||||
private TextBox PlaylistNewInputfield;
|
||||
private Label label1;
|
||||
private Label label2;
|
||||
private Label label3;
|
||||
private Label label4;
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
@@ -25,7 +26,6 @@ namespace MusicPlayer
|
||||
this.allPlaylistSongs = new List<Song>();
|
||||
this.allsongs = new List<Song>();
|
||||
InitializeComponent();
|
||||
Populate();
|
||||
}
|
||||
|
||||
public void PlaylistSelectBox_SelectedIndexChanged(object sender, EventArgs e)
|
||||
@@ -40,8 +40,10 @@ namespace MusicPlayer
|
||||
|
||||
public void Repopulate()
|
||||
{
|
||||
int selection = PlaylistSelectBox.SelectedIndex;
|
||||
PlaylistSelectBox.Items.Clear();
|
||||
pl.GetPlaylists().ForEach(p => PlaylistSelectBox.Items.Add(p.name));
|
||||
PlaylistSelectBox.SelectedIndex = selection;
|
||||
if (PlaylistSelectBox.SelectedItem != null)
|
||||
{
|
||||
PlaylistSongContainer.Items.Clear();
|
||||
@@ -53,8 +55,16 @@ namespace MusicPlayer
|
||||
public void Populate()
|
||||
{
|
||||
pl.GetPlaylists().ForEach(p => PlaylistSelectBox.Items.Add(p.name));
|
||||
if (PlaylistSelectBox.Items.Count > 0)
|
||||
PlaylistSelectBox.SelectedIndex = 0;
|
||||
allsongs = api.GetAllSongs();
|
||||
allsongs.ForEach(s => PlaylistSongSelector.Items.Add(s.Name));
|
||||
|
||||
if (PlaylistSelectBox.SelectedItem != null)
|
||||
{
|
||||
allPlaylistSongs = pl.GetPlaylistByName(PlaylistSelectBox.SelectedItem.ToString()).GetSongs();
|
||||
allPlaylistSongs.ForEach(s => PlaylistSongContainer.Items.Add(s.Name));
|
||||
}
|
||||
}
|
||||
|
||||
private void PlaylistAddSongsButton_Click(object sender, EventArgs e)
|
||||
@@ -74,6 +84,7 @@ namespace MusicPlayer
|
||||
}
|
||||
currentPlaylist.WriteToFile();
|
||||
}
|
||||
Thread.Sleep(10);
|
||||
Repopulate();
|
||||
}
|
||||
|
||||
@@ -82,5 +93,10 @@ namespace MusicPlayer
|
||||
pl.MakeNewPlaylistByName(PlaylistNewInputfield.Text);
|
||||
Repopulate();
|
||||
}
|
||||
|
||||
private void PlaylistMaker_Load(object sender, EventArgs e)
|
||||
{
|
||||
Populate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user