diff --git a/MusicPlayer/MusicPlayer/Main.cs b/MusicPlayer/MusicPlayer/Main.cs
index 621a820..f2c2989 100755
--- a/MusicPlayer/MusicPlayer/Main.cs
+++ b/MusicPlayer/MusicPlayer/Main.cs
@@ -39,6 +39,18 @@ namespace MusicPlayer
this.pl.GetPlaylists().ForEach(p => form.PlaylistBox.Items.Add(p.name));
}
+ public void Repopulate()
+ {
+ form.AlbumListView.Items.Clear();
+ form.ArtistListBox.Items.Clear();
+ form.GenreListBox.Items.Clear();
+ form.PlaylistBox.Items.Clear();
+ this.api.GetAlbums().ForEach(a => form.AlbumListView.Items.Add(a.albumnaam));
+ this.api.GetArtists().ForEach(a => form.ArtistListBox.Items.Add(a.naam));
+ this.api.GetGenres().ForEach(g => form.GenreListBox.Items.Add(g.name));
+ this.pl.GetPlaylists().ForEach(p => form.PlaylistBox.Items.Add(p.name));
+ }
+
public void ArtistFilter(string artist)
{
table.Clear();
@@ -57,6 +69,13 @@ namespace MusicPlayer
});
}
+ public void PlaylistFilter(string name)
+ {
+ table.Clear();
+ pl.GetPlaylistByName(name).GetSongs().ForEach(s => table.Add(s));
+
+ }
+
public void AlbumFilter(string album)
{
table.Clear();
diff --git a/MusicPlayer/MusicPlayer/MainForm.Designer.cs b/MusicPlayer/MusicPlayer/MainForm.Designer.cs
index be9dae2..518c87c 100644
--- a/MusicPlayer/MusicPlayer/MainForm.Designer.cs
+++ b/MusicPlayer/MusicPlayer/MainForm.Designer.cs
@@ -35,6 +35,7 @@
this.AlbumListView = new System.Windows.Forms.ListView();
this.ArtistListBox = new System.Windows.Forms.ListBox();
this.MainPanel = new System.Windows.Forms.Panel();
+ this.PlaylistListLabel = new System.Windows.Forms.Label();
this.AlbumListLabel = new System.Windows.Forms.Label();
this.ArtistListLabel = new System.Windows.Forms.Label();
this.GenreListLabel = new System.Windows.Forms.Label();
@@ -43,9 +44,14 @@
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
+ this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.viewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.playlistsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.overviewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.playlistsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.playlistToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.saveToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
+ this.loadToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.ControlsPanel = new System.Windows.Forms.Panel();
this.CurrentSongLabel = new System.Windows.Forms.Label();
this.SeperatorLabel = new System.Windows.Forms.Label();
@@ -59,12 +65,7 @@
this.PlayButton = new System.Windows.Forms.Button();
this.UpdateTimer = new System.Windows.Forms.Timer(this.components);
this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components);
- this.PlaylistListLabel = new System.Windows.Forms.Label();
- this.playlistToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.saveToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
- this.loadToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
+ this.makeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
((System.ComponentModel.ISupportInitialize)(this.SongsTableView)).BeginInit();
this.MainPanel.SuspendLayout();
this.MenuStrip.SuspendLayout();
@@ -150,6 +151,16 @@
this.MainPanel.Size = new System.Drawing.Size(784, 352);
this.MainPanel.TabIndex = 5;
//
+ // PlaylistListLabel
+ //
+ this.PlaylistListLabel.AutoSize = true;
+ this.PlaylistListLabel.Location = new System.Drawing.Point(12, 8);
+ this.PlaylistListLabel.Name = "PlaylistListLabel";
+ this.PlaylistListLabel.Size = new System.Drawing.Size(39, 13);
+ this.PlaylistListLabel.TabIndex = 7;
+ this.PlaylistListLabel.Text = "Playlist";
+ this.PlaylistListLabel.Visible = false;
+ //
// AlbumListLabel
//
this.AlbumListLabel.AutoSize = true;
@@ -187,6 +198,7 @@
this.PlaylistBox.Size = new System.Drawing.Size(760, 134);
this.PlaylistBox.TabIndex = 4;
this.PlaylistBox.Visible = false;
+ this.PlaylistBox.SelectedIndexChanged += new System.EventHandler(this.PlaylistBox_SelectedIndexChanged);
//
// MenuStrip
//
@@ -224,6 +236,18 @@
this.saveToolStripMenuItem.Size = new System.Drawing.Size(103, 22);
this.saveToolStripMenuItem.Text = "Save";
//
+ // toolStripSeparator1
+ //
+ this.toolStripSeparator1.Name = "toolStripSeparator1";
+ this.toolStripSeparator1.Size = new System.Drawing.Size(100, 6);
+ //
+ // exitToolStripMenuItem
+ //
+ this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
+ this.exitToolStripMenuItem.Size = new System.Drawing.Size(103, 22);
+ this.exitToolStripMenuItem.Text = "Exit";
+ this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
+ //
// viewToolStripMenuItem
//
this.viewToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
@@ -233,6 +257,13 @@
this.viewToolStripMenuItem.Size = new System.Drawing.Size(44, 20);
this.viewToolStripMenuItem.Text = "View";
//
+ // overviewToolStripMenuItem
+ //
+ this.overviewToolStripMenuItem.Name = "overviewToolStripMenuItem";
+ this.overviewToolStripMenuItem.Size = new System.Drawing.Size(123, 22);
+ this.overviewToolStripMenuItem.Text = "Overview";
+ this.overviewToolStripMenuItem.Click += new System.EventHandler(this.overviewToolStripMenuItem_Click);
+ //
// playlistsToolStripMenuItem
//
this.playlistsToolStripMenuItem.Name = "playlistsToolStripMenuItem";
@@ -240,12 +271,27 @@
this.playlistsToolStripMenuItem.Text = "Playlists";
this.playlistsToolStripMenuItem.Click += new System.EventHandler(this.playlistsToolStripMenuItem_Click);
//
- // overviewToolStripMenuItem
+ // playlistToolStripMenuItem
//
- this.overviewToolStripMenuItem.Name = "overviewToolStripMenuItem";
- this.overviewToolStripMenuItem.Size = new System.Drawing.Size(123, 22);
- this.overviewToolStripMenuItem.Text = "Overview";
- this.overviewToolStripMenuItem.Click += new System.EventHandler(this.overviewToolStripMenuItem_Click);
+ this.playlistToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.saveToolStripMenuItem1,
+ this.loadToolStripMenuItem,
+ this.makeToolStripMenuItem});
+ this.playlistToolStripMenuItem.Name = "playlistToolStripMenuItem";
+ this.playlistToolStripMenuItem.Size = new System.Drawing.Size(56, 20);
+ this.playlistToolStripMenuItem.Text = "Playlist";
+ //
+ // saveToolStripMenuItem1
+ //
+ this.saveToolStripMenuItem1.Name = "saveToolStripMenuItem1";
+ this.saveToolStripMenuItem1.Size = new System.Drawing.Size(152, 22);
+ this.saveToolStripMenuItem1.Text = "Save";
+ //
+ // loadToolStripMenuItem
+ //
+ this.loadToolStripMenuItem.Name = "loadToolStripMenuItem";
+ this.loadToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
+ this.loadToolStripMenuItem.Text = "Load";
//
// ControlsPanel
//
@@ -373,48 +419,12 @@
this.notifyIcon1.Visible = true;
this.notifyIcon1.Click += new System.EventHandler(this.notifyIcon1_Click);
//
- // PlaylistListLabel
+ // makeToolStripMenuItem
//
- this.PlaylistListLabel.AutoSize = true;
- this.PlaylistListLabel.Location = new System.Drawing.Point(12, 8);
- this.PlaylistListLabel.Name = "PlaylistListLabel";
- this.PlaylistListLabel.Size = new System.Drawing.Size(39, 13);
- this.PlaylistListLabel.TabIndex = 7;
- this.PlaylistListLabel.Text = "Playlist";
- this.PlaylistListLabel.Visible = false;
- //
- // playlistToolStripMenuItem
- //
- this.playlistToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.saveToolStripMenuItem1,
- this.loadToolStripMenuItem});
- this.playlistToolStripMenuItem.Name = "playlistToolStripMenuItem";
- this.playlistToolStripMenuItem.Size = new System.Drawing.Size(56, 20);
- this.playlistToolStripMenuItem.Text = "Playlist";
- //
- // saveToolStripMenuItem1
- //
- this.saveToolStripMenuItem1.Name = "saveToolStripMenuItem1";
- this.saveToolStripMenuItem1.Size = new System.Drawing.Size(152, 22);
- this.saveToolStripMenuItem1.Text = "Save";
- //
- // loadToolStripMenuItem
- //
- this.loadToolStripMenuItem.Name = "loadToolStripMenuItem";
- this.loadToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
- this.loadToolStripMenuItem.Text = "Load";
- //
- // exitToolStripMenuItem
- //
- this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
- this.exitToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
- this.exitToolStripMenuItem.Text = "Exit";
- this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
- //
- // toolStripSeparator1
- //
- this.toolStripSeparator1.Name = "toolStripSeparator1";
- this.toolStripSeparator1.Size = new System.Drawing.Size(149, 6);
+ this.makeToolStripMenuItem.Name = "makeToolStripMenuItem";
+ this.makeToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
+ this.makeToolStripMenuItem.Text = "Make";
+ this.makeToolStripMenuItem.Click += new System.EventHandler(this.makeToolStripMenuItem_Click);
//
// MainForm
//
@@ -481,6 +491,7 @@
private System.Windows.Forms.ToolStripMenuItem saveToolStripMenuItem1;
private System.Windows.Forms.ToolStripMenuItem loadToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
+ private System.Windows.Forms.ToolStripMenuItem makeToolStripMenuItem;
}
}
diff --git a/MusicPlayer/MusicPlayer/MainForm.cs b/MusicPlayer/MusicPlayer/MainForm.cs
index c0946fd..f703ec1 100644
--- a/MusicPlayer/MusicPlayer/MainForm.cs
+++ b/MusicPlayer/MusicPlayer/MainForm.cs
@@ -98,6 +98,14 @@ namespace MusicPlayer
}
}
+ private void PlaylistBox_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ if (PlaylistBox.SelectedItems.Count != 0)
+ {
+ main.PlaylistFilter(PlaylistBox.SelectedItems[0].ToString());
+ }
+ }
+
private void ArtistListBox_SelectedIndexChanged(object sender, EventArgs e)
{
if (ArtistListBox.SelectedItems.Count != 0)
@@ -175,5 +183,12 @@ namespace MusicPlayer
main.audio.AState = AudioHandler.AudioState.STOPPED;
System.Windows.Forms.Application.Exit();
}
+
+ private void makeToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ new PlaylistMaker(main.pl, main.api).Show();
+
+
+ }
}
}
diff --git a/MusicPlayer/MusicPlayer/MusicPlayer.csproj b/MusicPlayer/MusicPlayer/MusicPlayer.csproj
index 1911bc7..a2dc57f 100755
--- a/MusicPlayer/MusicPlayer/MusicPlayer.csproj
+++ b/MusicPlayer/MusicPlayer/MusicPlayer.csproj
@@ -75,6 +75,12 @@
+
+ Form
+
+
+ PlaylistMaker.cs
+
@@ -88,6 +94,9 @@
NotificationPopup.cs
+
+ PlaylistMaker.cs
+
ResXFileCodeGenerator
Resources.Designer.cs
diff --git a/MusicPlayer/MusicPlayer/Playlist.cs b/MusicPlayer/MusicPlayer/Playlist.cs
index 303d2ba..97665dd 100644
--- a/MusicPlayer/MusicPlayer/Playlist.cs
+++ b/MusicPlayer/MusicPlayer/Playlist.cs
@@ -8,12 +8,16 @@ namespace MusicPlayer
{
public string name { get; }
private string basedir;
- public List songs;
- public Playlist(string name, string basedir)
+ public List songs;
+
+ private APIHandler api;
+ public Playlist(string name, string basedir, APIHandler api)
{
this.songs = new List();
this.name = name;
+ this.api = api;
this.basedir = basedir;
+ this.ReadFromFile();
}
public void AddSong(Song s)
@@ -21,6 +25,34 @@ namespace MusicPlayer
this.songs.Add(s);
}
+ public List GetSongs()
+ {
+ return songs;
+ }
+
+ public void ReadFromFile()
+ {
+ try {
+ using (StreamReader str = new StreamReader(basedir + name + ".txt"))
+ {
+ string readline;
+ while ((readline = str.ReadLine()) != null)
+ {
+ string[] songsvalues = readline.Split('|');
+
+ songs.Add(new Song(songsvalues[0], songsvalues[1], songsvalues[2], songsvalues[3], songsvalues[4], Int32.Parse(songsvalues[5]), api));
+ }
+ }
+ }
+ catch (FileNotFoundException)
+ {
+ FileStream fs = new FileStream(basedir + name + ".txt", FileMode.CreateNew);
+ fs.Close();
+ ReadFromFile();
+ }
+
+ }
+
public void WriteToFile()
{
using (StreamWriter stw = new StreamWriter(basedir + name + ".txt"))
@@ -29,6 +61,7 @@ namespace MusicPlayer
{
stw.WriteLine(s.ToString());
});
+ stw.Flush();
}
}
}
diff --git a/MusicPlayer/MusicPlayer/PlaylistHandler.cs b/MusicPlayer/MusicPlayer/PlaylistHandler.cs
index e0f3450..b2acf9c 100644
--- a/MusicPlayer/MusicPlayer/PlaylistHandler.cs
+++ b/MusicPlayer/MusicPlayer/PlaylistHandler.cs
@@ -8,10 +8,12 @@ namespace MusicPlayer
public class PlaylistHandler
{
private List playlists;
+ private APIHandler api;
private readonly string basedir = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\.mpplaylists\\";
- public PlaylistHandler()
+ public PlaylistHandler(APIHandler api)
{
this.playlists = new List();
+ this.api = api;
Populate();
}
@@ -22,7 +24,7 @@ namespace MusicPlayer
{
if (f.EndsWith(".txt"))
{
- playlists.Add(new Playlist(Path.GetFileName(f.Replace(".txt","")) ,basedir));
+ playlists.Add(new Playlist(Path.GetFileName(f.Replace(".txt","")) ,basedir, api));
}
});
}
@@ -35,6 +37,21 @@ namespace MusicPlayer
}
+ public void MakeNewPlaylistByName(string name)
+ {
+ playlists.Add(new Playlist(name, basedir, api));
+ }
+
+ public Playlist GetPlaylistByName(string name)
+ {
+ Playlist toFind = null;
+ playlists.ForEach(p =>
+ {
+ if (p.name == name) { toFind = p; }
+ });
+ return toFind;
+ }
+
public List GetPlaylists()
{
return playlists;
diff --git a/MusicPlayer/MusicPlayer/PlaylistMaker.Designer.cs b/MusicPlayer/MusicPlayer/PlaylistMaker.Designer.cs
new file mode 100644
index 0000000..dbfd640
--- /dev/null
+++ b/MusicPlayer/MusicPlayer/PlaylistMaker.Designer.cs
@@ -0,0 +1,121 @@
+using System.Windows.Forms;
+
+namespace MusicPlayer
+{
+ partial class PlaylistMaker
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.PlaylistSelectBox = new System.Windows.Forms.ComboBox();
+ this.PlaylistSongSelector = new System.Windows.Forms.ListBox();
+ this.PlaylistAddSongsButton = new System.Windows.Forms.Button();
+ this.PlaylistSongContainer = new System.Windows.Forms.ListBox();
+ this.PlaylistNewButton = new System.Windows.Forms.Button();
+ this.PlaylistNewInputfield = new System.Windows.Forms.TextBox();
+ this.SuspendLayout();
+ //
+ // PlaylistSelectBox
+ //
+ this.PlaylistSelectBox.FormattingEnabled = true;
+ this.PlaylistSelectBox.Location = new System.Drawing.Point(12, 12);
+ this.PlaylistSelectBox.Name = "PlaylistSelectBox";
+ this.PlaylistSelectBox.Size = new System.Drawing.Size(354, 21);
+ this.PlaylistSelectBox.TabIndex = 0;
+ this.PlaylistSelectBox.SelectedIndexChanged += new System.EventHandler(this.PlaylistSelectBox_SelectedIndexChanged);
+ //
+ // PlaylistSongSelector
+ //
+ this.PlaylistSongSelector.FormattingEnabled = true;
+ this.PlaylistSongSelector.Location = new System.Drawing.Point(13, 39);
+ this.PlaylistSongSelector.Name = "PlaylistSongSelector";
+ this.PlaylistSongSelector.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended;
+ this.PlaylistSongSelector.Size = new System.Drawing.Size(353, 160);
+ this.PlaylistSongSelector.TabIndex = 1;
+ //
+ // PlaylistAddSongsButton
+ //
+ this.PlaylistAddSongsButton.Location = new System.Drawing.Point(12, 293);
+ this.PlaylistAddSongsButton.Name = "PlaylistAddSongsButton";
+ this.PlaylistAddSongsButton.Size = new System.Drawing.Size(354, 23);
+ this.PlaylistAddSongsButton.TabIndex = 2;
+ this.PlaylistAddSongsButton.Text = "Add";
+ 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.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.Name = "PlaylistNewButton";
+ this.PlaylistNewButton.Size = new System.Drawing.Size(75, 23);
+ this.PlaylistNewButton.TabIndex = 4;
+ this.PlaylistNewButton.Text = "New";
+ this.PlaylistNewButton.UseVisualStyleBackColor = true;
+ this.PlaylistNewButton.Click += new System.EventHandler(this.PlaylistNewButton_Click);
+ //
+ // PlaylistNewInputfield
+ //
+ this.PlaylistNewInputfield.Location = new System.Drawing.Point(12, 342);
+ this.PlaylistNewInputfield.Name = "PlaylistNewInputfield";
+ this.PlaylistNewInputfield.Size = new System.Drawing.Size(100, 20);
+ this.PlaylistNewInputfield.TabIndex = 5;
+ //
+ // 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.Controls.Add(this.PlaylistNewInputfield);
+ this.Controls.Add(this.PlaylistNewButton);
+ this.Controls.Add(this.PlaylistSongContainer);
+ this.Controls.Add(this.PlaylistAddSongsButton);
+ this.Controls.Add(this.PlaylistSongSelector);
+ this.Controls.Add(this.PlaylistSelectBox);
+ this.Name = "PlaylistMaker";
+ this.Text = "PlaylistMaker";
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.ComboBox PlaylistSelectBox;
+ private System.Windows.Forms.ListBox PlaylistSongSelector;
+ private System.Windows.Forms.Button PlaylistAddSongsButton;
+ private System.Windows.Forms.ListBox PlaylistSongContainer;
+ private Button PlaylistNewButton;
+ private TextBox PlaylistNewInputfield;
+ }
+}
\ No newline at end of file
diff --git a/MusicPlayer/MusicPlayer/PlaylistMaker.cs b/MusicPlayer/MusicPlayer/PlaylistMaker.cs
new file mode 100644
index 0000000..9b25b97
--- /dev/null
+++ b/MusicPlayer/MusicPlayer/PlaylistMaker.cs
@@ -0,0 +1,86 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace MusicPlayer
+{
+ public partial class PlaylistMaker : Form
+ {
+ private PlaylistHandler pl;
+ private APIHandler api;
+
+ private List allPlaylistSongs;
+ private List allsongs;
+
+ public PlaylistMaker(PlaylistHandler pl, APIHandler api)
+ {
+ this.pl = pl;
+ this.api = api;
+ this.allPlaylistSongs = new List();
+ this.allsongs = new List();
+ InitializeComponent();
+ Populate();
+ }
+
+ public void PlaylistSelectBox_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ if (PlaylistSelectBox.SelectedItem != null)
+ {
+ PlaylistSongContainer.Items.Clear();
+ allPlaylistSongs = pl.GetPlaylistByName(PlaylistSelectBox.SelectedItem.ToString()).GetSongs();
+ allPlaylistSongs.ForEach(s => PlaylistSongContainer.Items.Add(s.Name));
+ }
+ }
+
+ public void Repopulate()
+ {
+ PlaylistSelectBox.Items.Clear();
+ pl.GetPlaylists().ForEach(p => PlaylistSelectBox.Items.Add(p.name));
+ if (PlaylistSelectBox.SelectedItem != null)
+ {
+ PlaylistSongContainer.Items.Clear();
+ allPlaylistSongs = pl.GetPlaylistByName(PlaylistSelectBox.SelectedItem.ToString()).GetSongs();
+ allPlaylistSongs.ForEach(s => PlaylistSongContainer.Items.Add(s.Name));
+ }
+ }
+
+ public void Populate()
+ {
+ pl.GetPlaylists().ForEach(p => PlaylistSelectBox.Items.Add(p.name));
+ allsongs = api.GetAllSongs();
+ allsongs.ForEach(s => PlaylistSongSelector.Items.Add(s.Name));
+ }
+
+ private void PlaylistAddSongsButton_Click(object sender, EventArgs e)
+ {
+ if (PlaylistSelectBox.SelectedItem!=null)
+ {
+ Playlist currentPlaylist = pl.GetPlaylistByName(PlaylistSelectBox.SelectedItem.ToString());
+ foreach (string song in PlaylistSongSelector.SelectedItems)
+ {
+ foreach (Song s in allsongs) {
+ if (s.Name == song)
+ {
+ currentPlaylist.AddSong(s);
+ break;
+ }
+ }
+ }
+ currentPlaylist.WriteToFile();
+ }
+ Repopulate();
+ }
+
+ private void PlaylistNewButton_Click(object sender, EventArgs e)
+ {
+ pl.MakeNewPlaylistByName(PlaylistNewInputfield.Text);
+ Repopulate();
+ }
+ }
+}
diff --git a/MusicPlayer/MusicPlayer/PlaylistMaker.resx b/MusicPlayer/MusicPlayer/PlaylistMaker.resx
new file mode 100644
index 0000000..1af7de1
--- /dev/null
+++ b/MusicPlayer/MusicPlayer/PlaylistMaker.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/MusicPlayer/MusicPlayer/Program.cs b/MusicPlayer/MusicPlayer/Program.cs
index eaf250f..4b3b523 100755
--- a/MusicPlayer/MusicPlayer/Program.cs
+++ b/MusicPlayer/MusicPlayer/Program.cs
@@ -20,7 +20,7 @@ namespace MusicPlayer
NetworkHandler nw = new NetworkHandler("http://www.imegumii.nl");
APIHandler api = new APIHandler(nw);
MainForm form = new MainForm();
- PlaylistHandler pl = new PlaylistHandler();
+ PlaylistHandler pl = new PlaylistHandler(api);
new Main(nw, api, form,pl);
Application.Run(form);
diff --git a/MusicPlayer/MusicPlayer/Song.cs b/MusicPlayer/MusicPlayer/Song.cs
index aa8a637..d698b3f 100755
--- a/MusicPlayer/MusicPlayer/Song.cs
+++ b/MusicPlayer/MusicPlayer/Song.cs
@@ -51,7 +51,7 @@ namespace MusicPlayer
public override string ToString()
{
- return $"{this.SongID}|{this.Name}|{this.Album}|{this.Artist}|{this.Seconds}|{this.Genre}";
+ return $"{this.SongID}|{this.Name}|{this.Album}|{this.Artist}|{this.Genre}|{this.Seconds}";
}
}
}