48 Commits
Author SHA1 Message Date
Yorick Rommers d31519aeca refhresh on close dialog 2015-10-30 23:33:34 +01:00
kennyboy55 b3e397d0bf Merge branch 'developer' into gui
Conflicts:
	MusicPlayer/MusicPlayer/MainForm.Designer.cs
	MusicPlayer/MusicPlayer/MainForm.cs
2015-10-30 23:32:06 +01:00
kennyboy55 c7db59a8ab NotifyIcon contextmenu on left click 2015-10-30 23:13:52 +01:00
Yorick Rommers a0f52a636c Added playlist maker 2015-10-30 23:12:28 +01:00
kennyboy55 ff706d1bf5 Playlist fill. Format 2015-10-30 23:01:38 +01:00
kennyboy55 daf9f6d1ac Fix alignment in splitcontainer and moved playlistpanel 2015-10-30 22:20:16 +01:00
kennyboy55 3763e4fb22 Merge remote-tracking branch 'origin/gui' into gui 2015-10-30 21:38:21 +01:00
kennyboy55 e2be560a21 Changed album view 2015-10-30 21:37:48 +01:00
Janco Kock aaa9382e23 Added splitter 2015-10-30 21:27:12 +01:00
kennyboy55 9d78ac8b4b Error handling. Bugfix 2015-10-30 21:23:10 +01:00
kennyboy55 5f1093dd1c Bugfixes 2015-10-30 21:10:10 +01:00
kennyboy55 e80f9107c0 Better seeking. Better interface 2015-10-30 20:38:45 +01:00
Yorick Rommers 77a6951021 Merge remote-tracking branch 'origin/gui' into playlists 2015-10-30 20:33:43 +01:00
Yorick Rommers 08e485d6d4 Added base for playlists, puts files in dir and reads files from dir 2015-10-30 20:33:23 +01:00
kennyboy55 769f153e26 Add playlist buttons. Threadsafe application exit 2015-10-30 19:57:04 +01:00
Yorick Rommers d4f6869736 Merge remote-tracking branch 'origin/gui' into playlists 2015-10-30 19:48:50 +01:00
kennyboy55 c86b48da5f Added playlist to new interface 2015-10-30 19:45:34 +01:00
kennyboy55 bb60d94996 Merge remote-tracking branch 'origin/gui' into gui
Conflicts:
	MusicPlayer/MusicPlayer/MainForm.Designer.cs
2015-10-30 19:42:21 +01:00
Yorick Rommers ad6ee2f6ed Merge remote-tracking branch 'origin/gui' into developer 2015-10-30 19:41:53 +01:00
Yorick Rommers b6c90e97bd View buttonz added 2015-10-30 19:41:16 +01:00
kennyboy55 fe2f02a16d Merge remote-tracking branch 'origin/gui' into gui 2015-10-30 19:40:37 +01:00
kennyboy55 362a37f0eb Redesign interface 2015-10-30 19:40:22 +01:00
Yorick Rommers 7b763bac46 Lambdas to make things smaller 2015-10-30 19:21:58 +01:00
Yorick Rommers 91893e45e4 Genres added 2015-10-30 19:01:48 +01:00
kennyboy55 870c67595b Added missing code 2015-10-30 18:44:31 +01:00
kennyboy55 c0d5932f09 Disable Trackbar. Add Genre 2015-10-30 18:43:53 +01:00
Yorick Rommers 86d96515c0 Merge 2015-10-30 18:32:35 +01:00
Yorick Rommers 9bec1974f5 Reload mp3 stream when done buffering 2015-10-30 18:25:25 +01:00
kennyboy55 9a01b9e870 Attempt fix seeking (Again) 2015-10-30 17:37:53 +01:00
kennyboy55 41dd995175 New time handling in song 2015-10-30 16:48:33 +01:00
kennyboy55 e6d4eacd1c Fix seeking after SOMEONE broke it :p 2015-10-30 15:14:32 +01:00
Janco Kock 8c988dd475 Added fancy notification popup to taskbar 2015-10-30 11:46:42 +01:00
kennyboy55 5ad0fd72c2 Fixed trackbar jumping while seeking. 2015-10-30 11:21:12 +01:00
kennyboy55 c1f29f76c4 Merge remote-tracking branch 'origin/gui' into gui 2015-10-30 00:46:38 +01:00
kennyboy55 52903849f2 Timestamps. Attempt to fix seeking 2015-10-30 00:46:11 +01:00
kennyboy55 2d0b38e2d1 Display timestamps 2015-10-30 00:45:57 +01:00
kennyboy55 35097e88b9 Show timestamp. Play selected song with play button 2015-10-30 00:45:35 +01:00
Janco Kock 6090937072 Audio stops before playing another one 2015-10-30 00:25:27 +01:00
kennyboy55 23452531f9 Merge remote-tracking branch 'origin/gui' into gui 2015-10-30 00:18:12 +01:00
kennyboy55 1c8bde4f1e Semi-fix/add seeking. Still a problem when seeking further than ~20% of song. 2015-10-30 00:17:21 +01:00
Janco Kock 76f5753a6e Finally dubble click on a song plays a song 2015-10-30 00:16:45 +01:00
kennyboy55 c2afd44654 Merge remote-tracking branch 'origin/gui' into gui
Conflicts:
	MusicPlayer/MusicPlayer/MainForm.Designer.cs
	MusicPlayer/MusicPlayer/MainForm.cs
2015-10-29 23:45:57 +01:00
kennyboy55 4f5aaee125 Added visuals for buffering and position 2015-10-29 23:43:42 +01:00
Yorick Rommers da378f5fbf Implemented GetAllSongs 2015-10-29 23:24:40 +01:00
Janco Kock 2ddbe6e9c8 Merge refs/heads/developer into refs/heads/gui 2015-10-29 23:01:35 +01:00
Janco Kock 85028d04a9 Load data from server into views 2015-10-29 22:57:35 +01:00
kennyboy55 1f2983d712 Better Audio Handling 2015-10-29 22:48:54 +01:00
kennyboy55 615934557c Added more audio handling 2015-10-29 22:27:12 +01:00
36 changed files with 2595 additions and 164 deletions
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
+32 -1
View File
@@ -46,6 +46,22 @@ namespace MusicPlayer
return GetSongsByArgs("album=" + year); return GetSongsByArgs("album=" + year);
} }
public List<Song> GetAllSongs()
{
List<Song> allsongslist = new List<Song>();
JObject o = nw.SendString("getallsongs?");
if (o["result"].ToString() == "OK")
{
dynamic songs = o["songs"];
for (int i = 0; i < songs.Count; i++)
{
allsongslist.Add(new Song(songs[i][0].ToString(), songs[i][3].ToString(), songs[i][5].ToString(), songs[i][4].ToString(), songs[i][1].ToString(), (int)songs[i][9], this));
}
}
return allsongslist;
}
public List<Song> GetSongsByArgs(string args) public List<Song> GetSongsByArgs(string args)
{ {
List<Song> songslist = new List<Song>(); List<Song> songslist = new List<Song>();
@@ -55,7 +71,8 @@ namespace MusicPlayer
dynamic songs = o["songs"]; dynamic songs = o["songs"];
for (int i = 0; i < songs.Count; i++) for (int i = 0; i < songs.Count; i++)
{ {
songslist.Add(new Song(songs[i][0].ToString(), songs[i][3].ToString(), songs[i][5].ToString(), songs[i][4].ToString(), this)); if(songs[i][2].ToString().EndsWith(".mp3"))
songslist.Add(new Song(songs[i][0].ToString(), songs[i][3].ToString(), songs[i][5].ToString(), songs[i][4].ToString(), songs[i][1].ToString(), (int)songs[i][9], this));
} }
} }
return songslist; return songslist;
@@ -104,5 +121,19 @@ namespace MusicPlayer
} }
return yearlist; return yearlist;
} }
public List<Genre> GetGenres()
{
List<Genre> genreslist = new List<Genre>();
JObject o = nw.SendString("getgenres?id=hallo");
if (o["result"].ToString() == "OK")
{
for (int i = 0; i < o["genres"].Count(); i++)
{
genreslist.Add(new Genre(o["genres"][i][0].ToString()));
}
}
return genreslist;
}
} }
} }
Regular → Executable
View File
View File
View File
+216 -39
View File
@@ -12,47 +12,224 @@ namespace MusicPlayer
{ {
public class AudioHandler public class AudioHandler
{ {
public static Stream ms = new MemoryStream(); public enum AudioState { PLAYING, WAITING, STOPPED, PAUSED, SEEKING }
public enum BufferState { EMPTY, BUFFERING, DONE }
public AudioState AState { get; set; }
public BufferState BState { get; set; }
public static void PlayMp3FromUrl(string url) public int Buffered { get { return Math.Min((int)((bufpos / (double)LengthBuffer) * 1000), 1000); } }
private long LengthBuffer { get; set; }
private long bufpos = 0;
public int Position { get { return Math.Min((int)((playpos / (double)Length) * 1000), 1000); } }
private long Length { get; set; }
private long playpos = 0;
public int CurrentTime { get; set; }
public int TotalTime { get { return CurrentSong != null ? CurrentSong.Seconds : 0; } }
private long seek = 0;
private Stream ms;
private Thread network;
private Thread audio;
public Song CurrentSong;
public AudioHandler()
{ {
new Thread(delegate (object o) CreateThreads();
{
var response = WebRequest.Create(url).GetResponse();
using (var stream = response.GetResponseStream())
{
byte[] buffer = new byte[65536]; // 64KB chunks
int read;
while ((read = stream.Read(buffer, 0, buffer.Length)) > 0)
{
var pos = ms.Position;
ms.Position = ms.Length;
ms.Write(buffer, 0, read);
ms.Position = pos;
}
}
}).Start();
new Thread(delegate (object o)
{
// Pre-buffering some data to allow NAudio to start playing
while (ms.Length < 65536 * 10)
Thread.Sleep(1000);
ms.Position = 0;
using (WaveStream blockAlignedStream = new BlockAlignReductionStream(WaveFormatConversionStream.CreatePcmStream(new Mp3FileReader(ms))))
{
using (WaveOut waveOut = new WaveOut(WaveCallbackInfo.FunctionCallback()))
{
waveOut.Init(blockAlignedStream);
waveOut.Play();
while (waveOut.PlaybackState == PlaybackState.Playing)
{
System.Threading.Thread.Sleep(100);
}
}
}
}).Start();
} }
private void CreateThreads()
{
AState = AudioState.STOPPED;
BState = BufferState.EMPTY;
CurrentSong = null;
Thread.Sleep(11);
ms = new MemoryStream();
network = new Thread(LoadAudio);
audio = new Thread(PlayAudio);
network.IsBackground = true;
audio.IsBackground = true;
Length = 1;
LengthBuffer = 1;
bufpos = 0;
playpos = 0;
CurrentTime = 0;
}
public void Play(Song s)
{
if (CurrentSong == s && AState == AudioState.PAUSED)
AState = AudioState.PLAYING;
else
{
Stop();
CurrentSong = s;
network.Start(s);
audio.Start();
}
}
public void Seek(int position)
{
if (position >= Buffered-1)
return;
seek = Length / 1000 * position;
AState = AudioState.SEEKING;
}
public void Stop()
{
CreateThreads();
}
public void Pause()
{
if(CurrentSong == null)
AState = AudioState.STOPPED;
else
AState = AudioState.PAUSED;
}
private void StreamFromMP3(Stream s, long pos, bool firstrun)
{
long position = 0;
ms.Position = position;
Mp3FileReader mp3fr = null;
try
{
mp3fr = new Mp3FileReader(ms);
}
catch(Exception e)
{
AState = AudioState.STOPPED;
return;
}
using (WaveStream blockAlignedStream = new BlockAlignReductionStream(WaveFormatConversionStream.CreatePcmStream(mp3fr)))
{
blockAlignedStream.Position = pos;
using (WaveOut waveOut = new WaveOut(WaveCallbackInfo.FunctionCallback()))
{
waveOut.Init(blockAlignedStream);
waveOut.Play();
Length = CurrentSong.Seconds * waveOut.OutputWaveFormat.AverageBytesPerSecond;
CurrentTime = (int)(ms.Position / waveOut.OutputWaveFormat.AverageBytesPerSecond);
while (waveOut.PlaybackState != PlaybackState.Stopped)
{
System.Threading.Thread.Sleep(10);
if (AState == AudioState.PLAYING && waveOut.PlaybackState == PlaybackState.Paused)
{
blockAlignedStream.Position = position;
waveOut.Play();
}
if (AState == AudioState.PAUSED && waveOut.PlaybackState == PlaybackState.Playing)
{
position = blockAlignedStream.Position;
waveOut.Pause();
}
if (AState == AudioState.SEEKING)
{
blockAlignedStream.Seek(seek - (seek % blockAlignedStream.WaveFormat.BlockAlign), SeekOrigin.Begin);
AState = AudioState.PLAYING;
waveOut.Play();
}
if (AState == AudioState.STOPPED)
{
waveOut.Stop();
}
if (BState == BufferState.DONE && firstrun )
{
position = mp3fr.Position;
mp3fr.Close();
StreamFromMP3(ms,position, false);
break;
}
playpos = blockAlignedStream.Position;
CurrentTime = (int)(playpos / waveOut.OutputWaveFormat.AverageBytesPerSecond);
}
AState = AudioState.STOPPED;
playpos = 0;
CurrentTime = 0;
}
}
}
private void PlayAudio()
{
AState = AudioState.WAITING;
while (ms.Length < 65536 * 10 && BState != BufferState.DONE)
Thread.Sleep(1000);
AState = AudioState.PLAYING;
StreamFromMP3(ms,0, true);
}
private void LoadAudio(object o)
{
Song s = (Song) o;
WebResponse response = null;
try
{
response = WebRequest.Create(s.Url).GetResponse();
}
catch(Exception e)
{
BState = BufferState.EMPTY;
AState = AudioState.STOPPED;
return;
}
BState = BufferState.EMPTY;
LengthBuffer = response.ContentLength;
using (var stream = response.GetResponseStream())
{
//byte[] buffer = new byte[65536]; // 64KB chunks
byte[] buffer = new byte[65536*4]; // 256KB chunks
int read;
BState = BufferState.BUFFERING;
AState = AudioState.WAITING;
while ((read = stream.Read(buffer, 0, buffer.Length)) > 0 && AState != AudioState.STOPPED)
{
var pos = ms.Position;
ms.Position = ms.Length;
ms.Write(buffer, 0, read);
ms.Position = pos;
this.bufpos = ms.Length;
}
}
BState = BufferState.DONE;
}
} }
} }
Generated Regular → Executable
View File
View File
+11
View File
@@ -0,0 +1,11 @@
namespace MusicPlayer
{
public class Genre
{
public string name { get; set; }
public Genre(string name)
{
this.name = name;
}
}
}
Regular → Executable
+71 -13
View File
@@ -11,41 +11,99 @@ namespace MusicPlayer
public APIHandler api; public APIHandler api;
public MainForm form; public MainForm form;
public NetworkHandler nw; public NetworkHandler nw;
public PlaylistHandler pl;
public AudioHandler audio; public AudioHandler audio;
private SongsTable table; private SongsTable table;
public Main(NetworkHandler nw, APIHandler api, MainForm form) public Main(NetworkHandler nw, APIHandler api, MainForm form, PlaylistHandler pl)
{ {
this.nw = nw; this.nw = nw;
this.api = api; this.api = api;
this.form = form; this.form = form;
form.main = this; form.main = this;
this.pl = pl;
audio = new AudioHandler(); audio = new AudioHandler();
table = new SongsTable(); table = new SongsTable();
form.SongsTableView.DataSource = table; form.SongsTableView.DataSource = table;
form.SongsTableView.Columns[5].Visible = false;
Populate(); Populate();
} }
private void Populate() private void Populate()
{ {
table.Add(new Song("102", "Test Song 1", "Test Album 1", "Test Artist 1", api)); 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));
}
form.GenreListBox.Items.Add("Hardcore"); public void Repopulate()
form.GenreListBox.Items.Add("Hardstyle"); {
form.GenreListBox.Items.Add("Pop"); 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));
}
form.ArtistListBox.Items.Add("Kygo"); public void ArtistFilter(string artist)
form.ArtistListBox.Items.Add("Monstercat"); {
form.ArtistListBox.Items.Add("Mozart"); table.Clear();
api.GetSongsByArtist(artist).ForEach(s =>
{
table.Add(s);
});
}
form.AlbumListView.Items.Add("Album 1"); public void GenreFilter(string genre)
form.AlbumListView.Items.Add("Album 2"); {
form.AlbumListView.Items.Add("Album 3"); table.Clear();
api.GetSongsByGenre(genre).ForEach(s =>
{
table.Add(s);
});
}
table.Add(new Song("104", "Test Song 2", "Test Album 2", "Test Artist 2", api)); public void PlaylistFilter(string name)
{
table.Clear();
pl.GetPlaylistByName(name).GetSongs().ForEach(s => table.Add(s));
}
public void AlbumFilter(string album)
{
table.Clear();
api.GetSongsByAlbum(album).ForEach(s =>
{
table.Add(s);
});
}
public static string SecondsToTimestamp(int seconds)
{
string str = "";
//Hours
str += (seconds / 3600).ToString("D2") + ":";
seconds %= 3600;
//Minutes
str += (seconds / 60).ToString("D2") + ":";
seconds %= 60;
//Seconds
str += seconds.ToString("D2");
return str;
} }
} }
} }
+409 -38
View File
@@ -21,30 +21,67 @@
} }
#region Windows Form Designer generated code #region Windows Form Designer generated code
bool clicked = false;
/// <summary> /// <summary>
/// Required method for Designer support - do not modify /// Required method for Designer support - do not modify
/// the contents of this method with the code editor. /// the contents of this method with the code editor.
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm)); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
this.SongsTableView = new System.Windows.Forms.DataGridView(); this.SongsTableView = new System.Windows.Forms.DataGridView();
this.GenreListBox = new System.Windows.Forms.ListBox(); this.GenreListBox = new System.Windows.Forms.ListBox();
this.AlbumListView = new System.Windows.Forms.ListView(); this.AlbumListView = new System.Windows.Forms.ListView();
this.ArtistListBox = new System.Windows.Forms.ListBox(); this.ArtistListBox = new System.Windows.Forms.ListBox();
this.MainPanel = new System.Windows.Forms.Panel(); this.MainPanel = new System.Windows.Forms.Panel();
this.SplitContainer = new System.Windows.Forms.SplitContainer();
this.PlaylistBox = new System.Windows.Forms.ListBox();
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();
this.MenuStrip = new System.Windows.Forms.MenuStrip(); this.MenuStrip = new System.Windows.Forms.MenuStrip();
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.viewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.viewToolStripMenuItem = 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.makeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.ControlsPanel = new System.Windows.Forms.Panel(); this.ControlsPanel = new System.Windows.Forms.Panel();
this.CurrentSongLabel = new System.Windows.Forms.Label();
this.SeperatorLabel = new System.Windows.Forms.Label();
this.LabelTotalTime = new System.Windows.Forms.Label();
this.LabelCurrentTime = new System.Windows.Forms.Label();
this.PositionTrackBar = new System.Windows.Forms.TrackBar();
this.BufferLabel = new System.Windows.Forms.Label();
this.BufferBar = new System.Windows.Forms.ProgressBar();
this.StopButton = new System.Windows.Forms.Button();
this.PauseButton = new System.Windows.Forms.Button();
this.PlayButton = new System.Windows.Forms.Button(); this.PlayButton = new System.Windows.Forms.Button();
this.UpdateTimer = new System.Windows.Forms.Timer(this.components);
this.NotifyIcon = new System.Windows.Forms.NotifyIcon(this.components);
this.NotifyMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components);
this.NotifyMenuStripPlayingLabel = new System.Windows.Forms.ToolStripMenuItem();
this.NotifyMenuStripPlayingSongLabel = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
this.NotifyMenuStripPlayButton = new System.Windows.Forms.ToolStripMenuItem();
this.NotifyMenuStripPauseButton = new System.Windows.Forms.ToolStripMenuItem();
this.NotifyMenuStripStopButton = new System.Windows.Forms.ToolStripMenuItem();
((System.ComponentModel.ISupportInitialize)(this.SongsTableView)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.SongsTableView)).BeginInit();
this.MainPanel.SuspendLayout(); this.MainPanel.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.SplitContainer)).BeginInit();
this.SplitContainer.Panel1.SuspendLayout();
this.SplitContainer.Panel2.SuspendLayout();
this.SplitContainer.SuspendLayout();
this.MenuStrip.SuspendLayout(); this.MenuStrip.SuspendLayout();
this.ControlsPanel.SuspendLayout(); this.ControlsPanel.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.PositionTrackBar)).BeginInit();
this.NotifyMenuStrip.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// SongsTableView // SongsTableView
@@ -52,54 +89,63 @@
this.SongsTableView.AllowUserToAddRows = false; this.SongsTableView.AllowUserToAddRows = false;
this.SongsTableView.AllowUserToDeleteRows = false; this.SongsTableView.AllowUserToDeleteRows = false;
this.SongsTableView.AllowUserToResizeRows = false; this.SongsTableView.AllowUserToResizeRows = false;
this.SongsTableView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.SongsTableView.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill; this.SongsTableView.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
this.SongsTableView.BackgroundColor = System.Drawing.SystemColors.Control; this.SongsTableView.BackgroundColor = System.Drawing.SystemColors.Control;
this.SongsTableView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.SongsTableView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.SongsTableView.Location = new System.Drawing.Point(12, 153); this.SongsTableView.Dock = System.Windows.Forms.DockStyle.Fill;
this.SongsTableView.Location = new System.Drawing.Point(0, 0);
this.SongsTableView.MultiSelect = false; this.SongsTableView.MultiSelect = false;
this.SongsTableView.Name = "SongsTableView"; this.SongsTableView.Name = "SongsTableView";
this.SongsTableView.ReadOnly = true; this.SongsTableView.ReadOnly = true;
this.SongsTableView.RowHeadersVisible = false; this.SongsTableView.RowHeadersVisible = false;
this.SongsTableView.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; this.SongsTableView.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.SongsTableView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; this.SongsTableView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.SongsTableView.Size = new System.Drawing.Size(760, 148); this.SongsTableView.Size = new System.Drawing.Size(760, 175);
this.SongsTableView.TabIndex = 0; this.SongsTableView.TabIndex = 0;
this.SongsTableView.SelectionChanged += new System.EventHandler(this.SongsTableView_SelectionChanged); this.SongsTableView.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.SongsTableView_CellDoubleClick);
// //
// GenreListBox // GenreListBox
// //
this.GenreListBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)));
this.GenreListBox.BackColor = System.Drawing.SystemColors.Control; this.GenreListBox.BackColor = System.Drawing.SystemColors.Control;
this.GenreListBox.FormattingEnabled = true; this.GenreListBox.FormattingEnabled = true;
this.GenreListBox.Location = new System.Drawing.Point(12, 12); this.GenreListBox.Location = new System.Drawing.Point(3, 3);
this.GenreListBox.Name = "GenreListBox"; this.GenreListBox.Name = "GenreListBox";
this.GenreListBox.Size = new System.Drawing.Size(124, 134); this.GenreListBox.Size = new System.Drawing.Size(150, 121);
this.GenreListBox.Sorted = true; this.GenreListBox.Sorted = true;
this.GenreListBox.TabIndex = 1; this.GenreListBox.TabIndex = 1;
this.GenreListBox.SelectedIndexChanged += new System.EventHandler(this.GenreListBox_SelectedIndexChanged);
// //
// AlbumListView // AlbumListView
// //
this.AlbumListView.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) this.AlbumListView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.AlbumListView.BackColor = System.Drawing.SystemColors.Control; this.AlbumListView.BackColor = System.Drawing.SystemColors.Control;
this.AlbumListView.Location = new System.Drawing.Point(272, 12); this.AlbumListView.Location = new System.Drawing.Point(309, 3);
this.AlbumListView.MultiSelect = false;
this.AlbumListView.Name = "AlbumListView"; this.AlbumListView.Name = "AlbumListView";
this.AlbumListView.Size = new System.Drawing.Size(500, 134); this.AlbumListView.Size = new System.Drawing.Size(451, 121);
this.AlbumListView.Sorting = System.Windows.Forms.SortOrder.Ascending; this.AlbumListView.Sorting = System.Windows.Forms.SortOrder.Ascending;
this.AlbumListView.TabIndex = 2; this.AlbumListView.TabIndex = 2;
this.AlbumListView.TileSize = new System.Drawing.Size(140, 30);
this.AlbumListView.UseCompatibleStateImageBehavior = false; this.AlbumListView.UseCompatibleStateImageBehavior = false;
this.AlbumListView.View = System.Windows.Forms.View.Tile;
this.AlbumListView.SelectedIndexChanged += new System.EventHandler(this.AlbumListView_SelectedIndexChanged);
// //
// ArtistListBox // ArtistListBox
// //
this.ArtistListBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)));
this.ArtistListBox.BackColor = System.Drawing.SystemColors.Control; this.ArtistListBox.BackColor = System.Drawing.SystemColors.Control;
this.ArtistListBox.FormattingEnabled = true; this.ArtistListBox.FormattingEnabled = true;
this.ArtistListBox.Location = new System.Drawing.Point(142, 12); this.ArtistListBox.Location = new System.Drawing.Point(156, 3);
this.ArtistListBox.Name = "ArtistListBox"; this.ArtistListBox.Name = "ArtistListBox";
this.ArtistListBox.Size = new System.Drawing.Size(124, 134); this.ArtistListBox.Size = new System.Drawing.Size(150, 121);
this.ArtistListBox.Sorted = true; this.ArtistListBox.Sorted = true;
this.ArtistListBox.TabIndex = 3; this.ArtistListBox.TabIndex = 3;
this.ArtistListBox.SelectedIndexChanged += new System.EventHandler(this.ArtistListBox_SelectedIndexChanged);
// //
// MainPanel // MainPanel
// //
@@ -107,21 +153,95 @@
| System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.MainPanel.BackColor = System.Drawing.SystemColors.Window; this.MainPanel.BackColor = System.Drawing.SystemColors.Window;
this.MainPanel.Controls.Add(this.GenreListBox); this.MainPanel.Controls.Add(this.SplitContainer);
this.MainPanel.Controls.Add(this.ArtistListBox); this.MainPanel.Controls.Add(this.PlaylistListLabel);
this.MainPanel.Controls.Add(this.AlbumListView); this.MainPanel.Controls.Add(this.AlbumListLabel);
this.MainPanel.Controls.Add(this.SongsTableView); this.MainPanel.Controls.Add(this.ArtistListLabel);
this.MainPanel.Controls.Add(this.GenreListLabel);
this.MainPanel.Location = new System.Drawing.Point(0, 24); this.MainPanel.Location = new System.Drawing.Point(0, 24);
this.MainPanel.Name = "MainPanel"; this.MainPanel.Name = "MainPanel";
this.MainPanel.Size = new System.Drawing.Size(784, 313); this.MainPanel.Size = new System.Drawing.Size(784, 352);
this.MainPanel.TabIndex = 5; this.MainPanel.TabIndex = 5;
// //
// SplitContainer
//
this.SplitContainer.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.SplitContainer.Location = new System.Drawing.Point(12, 25);
this.SplitContainer.Name = "SplitContainer";
this.SplitContainer.Orientation = System.Windows.Forms.Orientation.Horizontal;
//
// SplitContainer.Panel1
//
this.SplitContainer.Panel1.Controls.Add(this.AlbumListView);
this.SplitContainer.Panel1.Controls.Add(this.ArtistListBox);
this.SplitContainer.Panel1.Controls.Add(this.GenreListBox);
this.SplitContainer.Panel1.Controls.Add(this.PlaylistBox);
//
// SplitContainer.Panel2
//
this.SplitContainer.Panel2.Controls.Add(this.SongsTableView);
this.SplitContainer.Size = new System.Drawing.Size(760, 314);
this.SplitContainer.SplitterDistance = 131;
this.SplitContainer.SplitterWidth = 8;
this.SplitContainer.TabIndex = 9;
//
// PlaylistBox
//
this.PlaylistBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.PlaylistBox.FormattingEnabled = true;
this.PlaylistBox.Location = new System.Drawing.Point(0, 0);
this.PlaylistBox.Name = "PlaylistBox";
this.PlaylistBox.Size = new System.Drawing.Size(760, 131);
this.PlaylistBox.TabIndex = 4;
this.PlaylistBox.Visible = false;
this.PlaylistBox.SelectedIndexChanged += new System.EventHandler(this.PlaylistBox_SelectedIndexChanged);
//
// 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;
this.AlbumListLabel.Location = new System.Drawing.Point(321, 9);
this.AlbumListLabel.Name = "AlbumListLabel";
this.AlbumListLabel.Size = new System.Drawing.Size(36, 13);
this.AlbumListLabel.TabIndex = 6;
this.AlbumListLabel.Text = "Album";
//
// ArtistListLabel
//
this.ArtistListLabel.AutoSize = true;
this.ArtistListLabel.Location = new System.Drawing.Point(165, 9);
this.ArtistListLabel.Name = "ArtistListLabel";
this.ArtistListLabel.Size = new System.Drawing.Size(30, 13);
this.ArtistListLabel.TabIndex = 5;
this.ArtistListLabel.Text = "Artist";
//
// GenreListLabel
//
this.GenreListLabel.AutoSize = true;
this.GenreListLabel.Location = new System.Drawing.Point(12, 9);
this.GenreListLabel.Name = "GenreListLabel";
this.GenreListLabel.Size = new System.Drawing.Size(36, 13);
this.GenreListLabel.TabIndex = 4;
this.GenreListLabel.Text = "Genre";
//
// MenuStrip // MenuStrip
// //
this.MenuStrip.BackColor = System.Drawing.SystemColors.Window; this.MenuStrip.BackColor = System.Drawing.SystemColors.WindowFrame;
this.MenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.MenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.fileToolStripMenuItem, this.fileToolStripMenuItem,
this.viewToolStripMenuItem}); this.viewToolStripMenuItem,
this.playlistToolStripMenuItem});
this.MenuStrip.Location = new System.Drawing.Point(0, 0); this.MenuStrip.Location = new System.Drawing.Point(0, 0);
this.MenuStrip.Name = "MenuStrip"; this.MenuStrip.Name = "MenuStrip";
this.MenuStrip.Size = new System.Drawing.Size(784, 24); this.MenuStrip.Size = new System.Drawing.Size(784, 24);
@@ -131,43 +251,186 @@
// fileToolStripMenuItem // fileToolStripMenuItem
// //
this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.openToolStripMenuItem, this.toolStripSeparator1,
this.saveToolStripMenuItem}); this.exitToolStripMenuItem});
this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20); this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20);
this.fileToolStripMenuItem.Text = "File"; this.fileToolStripMenuItem.Text = "File";
// //
// openToolStripMenuItem // toolStripSeparator1
// //
this.openToolStripMenuItem.Name = "openToolStripMenuItem"; this.toolStripSeparator1.Name = "toolStripSeparator1";
this.openToolStripMenuItem.Size = new System.Drawing.Size(103, 22); this.toolStripSeparator1.Size = new System.Drawing.Size(89, 6);
this.openToolStripMenuItem.Text = "Open";
// //
// saveToolStripMenuItem // exitToolStripMenuItem
// //
this.saveToolStripMenuItem.Name = "saveToolStripMenuItem"; this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
this.saveToolStripMenuItem.Size = new System.Drawing.Size(103, 22); this.exitToolStripMenuItem.Size = new System.Drawing.Size(92, 22);
this.saveToolStripMenuItem.Text = "Save"; this.exitToolStripMenuItem.Text = "Exit";
this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
// //
// viewToolStripMenuItem // viewToolStripMenuItem
// //
this.viewToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.overviewToolStripMenuItem,
this.playlistsToolStripMenuItem});
this.viewToolStripMenuItem.Name = "viewToolStripMenuItem"; this.viewToolStripMenuItem.Name = "viewToolStripMenuItem";
this.viewToolStripMenuItem.Size = new System.Drawing.Size(44, 20); this.viewToolStripMenuItem.Size = new System.Drawing.Size(44, 20);
this.viewToolStripMenuItem.Text = "View"; 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";
this.playlistsToolStripMenuItem.Size = new System.Drawing.Size(123, 22);
this.playlistsToolStripMenuItem.Text = "Playlists";
this.playlistsToolStripMenuItem.Click += new System.EventHandler(this.playlistsToolStripMenuItem_Click);
//
// playlistToolStripMenuItem
//
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(103, 22);
this.saveToolStripMenuItem1.Text = "Save";
//
// loadToolStripMenuItem
//
this.loadToolStripMenuItem.Name = "loadToolStripMenuItem";
this.loadToolStripMenuItem.Size = new System.Drawing.Size(103, 22);
this.loadToolStripMenuItem.Text = "Load";
//
// makeToolStripMenuItem
//
this.makeToolStripMenuItem.Name = "makeToolStripMenuItem";
this.makeToolStripMenuItem.Size = new System.Drawing.Size(103, 22);
this.makeToolStripMenuItem.Text = "Make";
this.makeToolStripMenuItem.Click += new System.EventHandler(this.makeToolStripMenuItem_Click);
//
// ControlsPanel // ControlsPanel
// //
this.ControlsPanel.BackColor = System.Drawing.SystemColors.WindowFrame; this.ControlsPanel.BackColor = System.Drawing.SystemColors.WindowFrame;
this.ControlsPanel.Controls.Add(this.CurrentSongLabel);
this.ControlsPanel.Controls.Add(this.SeperatorLabel);
this.ControlsPanel.Controls.Add(this.LabelTotalTime);
this.ControlsPanel.Controls.Add(this.LabelCurrentTime);
this.ControlsPanel.Controls.Add(this.PositionTrackBar);
this.ControlsPanel.Controls.Add(this.BufferLabel);
this.ControlsPanel.Controls.Add(this.BufferBar);
this.ControlsPanel.Controls.Add(this.StopButton);
this.ControlsPanel.Controls.Add(this.PauseButton);
this.ControlsPanel.Controls.Add(this.PlayButton); this.ControlsPanel.Controls.Add(this.PlayButton);
this.ControlsPanel.Dock = System.Windows.Forms.DockStyle.Bottom; this.ControlsPanel.Dock = System.Windows.Forms.DockStyle.Bottom;
this.ControlsPanel.Location = new System.Drawing.Point(0, 343); this.ControlsPanel.Location = new System.Drawing.Point(0, 379);
this.ControlsPanel.Name = "ControlsPanel"; this.ControlsPanel.Name = "ControlsPanel";
this.ControlsPanel.Size = new System.Drawing.Size(784, 119); this.ControlsPanel.Size = new System.Drawing.Size(784, 83);
this.ControlsPanel.TabIndex = 4; this.ControlsPanel.TabIndex = 4;
// //
// CurrentSongLabel
//
this.CurrentSongLabel.AutoSize = true;
this.CurrentSongLabel.Location = new System.Drawing.Point(256, 56);
this.CurrentSongLabel.Name = "CurrentSongLabel";
this.CurrentSongLabel.Size = new System.Drawing.Size(111, 13);
this.CurrentSongLabel.TabIndex = 11;
this.CurrentSongLabel.Text = "Not playing any songs";
//
// SeperatorLabel
//
this.SeperatorLabel.AutoSize = true;
this.SeperatorLabel.Location = new System.Drawing.Point(67, 35);
this.SeperatorLabel.Name = "SeperatorLabel";
this.SeperatorLabel.Size = new System.Drawing.Size(12, 13);
this.SeperatorLabel.TabIndex = 10;
this.SeperatorLabel.Text = "/";
//
// LabelTotalTime
//
this.LabelTotalTime.AutoSize = true;
this.LabelTotalTime.Location = new System.Drawing.Point(90, 35);
this.LabelTotalTime.Name = "LabelTotalTime";
this.LabelTotalTime.Size = new System.Drawing.Size(49, 13);
this.LabelTotalTime.TabIndex = 9;
this.LabelTotalTime.Text = "00:00:00";
//
// LabelCurrentTime
//
this.LabelCurrentTime.AutoSize = true;
this.LabelCurrentTime.Location = new System.Drawing.Point(12, 35);
this.LabelCurrentTime.Name = "LabelCurrentTime";
this.LabelCurrentTime.Size = new System.Drawing.Size(49, 13);
this.LabelCurrentTime.TabIndex = 8;
this.LabelCurrentTime.Text = "00:00:00";
//
// PositionTrackBar
//
this.PositionTrackBar.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.PositionTrackBar.Enabled = false;
this.PositionTrackBar.Location = new System.Drawing.Point(3, 3);
this.PositionTrackBar.Maximum = 1000;
this.PositionTrackBar.Name = "PositionTrackBar";
this.PositionTrackBar.Size = new System.Drawing.Size(778, 45);
this.PositionTrackBar.TabIndex = 7;
this.PositionTrackBar.TickStyle = System.Windows.Forms.TickStyle.None;
//
// BufferLabel
//
this.BufferLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.BufferLabel.AutoSize = true;
this.BufferLabel.Location = new System.Drawing.Point(597, 56);
this.BufferLabel.Name = "BufferLabel";
this.BufferLabel.Size = new System.Drawing.Size(35, 13);
this.BufferLabel.TabIndex = 5;
this.BufferLabel.Text = "Buffer";
//
// BufferBar
//
this.BufferBar.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.BufferBar.Location = new System.Drawing.Point(638, 51);
this.BufferBar.Name = "BufferBar";
this.BufferBar.Size = new System.Drawing.Size(134, 23);
this.BufferBar.TabIndex = 3;
//
// StopButton
//
this.StopButton.Enabled = false;
this.StopButton.Location = new System.Drawing.Point(174, 51);
this.StopButton.Name = "StopButton";
this.StopButton.Size = new System.Drawing.Size(75, 23);
this.StopButton.TabIndex = 2;
this.StopButton.Text = "Stop";
this.StopButton.UseVisualStyleBackColor = true;
this.StopButton.Click += new System.EventHandler(this.StopButton_Click);
//
// PauseButton
//
this.PauseButton.Enabled = false;
this.PauseButton.Location = new System.Drawing.Point(93, 51);
this.PauseButton.Name = "PauseButton";
this.PauseButton.Size = new System.Drawing.Size(75, 23);
this.PauseButton.TabIndex = 1;
this.PauseButton.Text = "Pause";
this.PauseButton.UseVisualStyleBackColor = true;
this.PauseButton.Click += new System.EventHandler(this.PauseButton_Click);
//
// PlayButton // PlayButton
// //
this.PlayButton.Location = new System.Drawing.Point(12, 13); this.PlayButton.Location = new System.Drawing.Point(12, 51);
this.PlayButton.Name = "PlayButton"; this.PlayButton.Name = "PlayButton";
this.PlayButton.Size = new System.Drawing.Size(75, 23); this.PlayButton.Size = new System.Drawing.Size(75, 23);
this.PlayButton.TabIndex = 0; this.PlayButton.TabIndex = 0;
@@ -175,6 +438,75 @@
this.PlayButton.UseVisualStyleBackColor = true; this.PlayButton.UseVisualStyleBackColor = true;
this.PlayButton.Click += new System.EventHandler(this.PlayButton_Click); this.PlayButton.Click += new System.EventHandler(this.PlayButton_Click);
// //
// UpdateTimer
//
this.UpdateTimer.Interval = 150;
this.UpdateTimer.Tick += new System.EventHandler(this.UpdateTimer_Tick);
//
// NotifyIcon
//
this.NotifyIcon.ContextMenuStrip = this.NotifyMenuStrip;
this.NotifyIcon.Icon = ((System.Drawing.Icon)(resources.GetObject("NotifyIcon.Icon")));
this.NotifyIcon.Text = "NotifyIcon";
this.NotifyIcon.Visible = true;
this.NotifyIcon.MouseUp += new System.Windows.Forms.MouseEventHandler(this.NotifyIcon_Click);
//
// NotifyMenuStrip
//
this.NotifyMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.NotifyMenuStripPlayingLabel,
this.toolStripSeparator2,
this.NotifyMenuStripPlayButton,
this.NotifyMenuStripPauseButton,
this.NotifyMenuStripStopButton});
this.NotifyMenuStrip.Name = "NotifyMenuStrip";
this.NotifyMenuStrip.Size = new System.Drawing.Size(119, 98);
//
// NotifyMenuStripPlayingLabel
//
this.NotifyMenuStripPlayingLabel.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.NotifyMenuStripPlayingSongLabel});
this.NotifyMenuStripPlayingLabel.Enabled = false;
this.NotifyMenuStripPlayingLabel.Name = "NotifyMenuStripPlayingLabel";
this.NotifyMenuStripPlayingLabel.Size = new System.Drawing.Size(118, 22);
this.NotifyMenuStripPlayingLabel.Text = "Stopped";
//
// NotifyMenuStripPlayingSongLabel
//
this.NotifyMenuStripPlayingSongLabel.Enabled = false;
this.NotifyMenuStripPlayingSongLabel.Name = "NotifyMenuStripPlayingSongLabel";
this.NotifyMenuStripPlayingSongLabel.Size = new System.Drawing.Size(118, 22);
this.NotifyMenuStripPlayingSongLabel.Text = "Stopped";
this.NotifyMenuStripPlayingSongLabel.Visible = false;
//
// toolStripSeparator2
//
this.toolStripSeparator2.Name = "toolStripSeparator2";
this.toolStripSeparator2.Size = new System.Drawing.Size(115, 6);
//
// NotifyMenuStripPlayButton
//
this.NotifyMenuStripPlayButton.Name = "NotifyMenuStripPlayButton";
this.NotifyMenuStripPlayButton.Size = new System.Drawing.Size(118, 22);
this.NotifyMenuStripPlayButton.Text = "Play";
this.NotifyMenuStripPlayButton.Click += new System.EventHandler(this.NotifyMenuStripPlayButton_Click);
//
// NotifyMenuStripPauseButton
//
this.NotifyMenuStripPauseButton.Enabled = false;
this.NotifyMenuStripPauseButton.Name = "NotifyMenuStripPauseButton";
this.NotifyMenuStripPauseButton.Size = new System.Drawing.Size(118, 22);
this.NotifyMenuStripPauseButton.Text = "Pause";
this.NotifyMenuStripPauseButton.Click += new System.EventHandler(this.NotifyMenuStripPauseButton_Click);
//
// NotifyMenuStripStopButton
//
this.NotifyMenuStripStopButton.Enabled = false;
this.NotifyMenuStripStopButton.Name = "NotifyMenuStripStopButton";
this.NotifyMenuStripStopButton.Size = new System.Drawing.Size(118, 22);
this.NotifyMenuStripStopButton.Text = "Stop";
this.NotifyMenuStripStopButton.Click += new System.EventHandler(this.NotifyMenuStripStopButton_Click);
//
// MainForm // MainForm
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -188,12 +520,21 @@
this.MinimumSize = new System.Drawing.Size(800, 500); this.MinimumSize = new System.Drawing.Size(800, 500);
this.Name = "MainForm"; this.Name = "MainForm";
this.Text = "YJMPD Music Player"; this.Text = "YJMPD Music Player";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MainForm_FormClosing);
this.Load += new System.EventHandler(this.MainForm_Load); this.Load += new System.EventHandler(this.MainForm_Load);
((System.ComponentModel.ISupportInitialize)(this.SongsTableView)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.SongsTableView)).EndInit();
this.MainPanel.ResumeLayout(false); this.MainPanel.ResumeLayout(false);
this.MainPanel.PerformLayout();
this.SplitContainer.Panel1.ResumeLayout(false);
this.SplitContainer.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.SplitContainer)).EndInit();
this.SplitContainer.ResumeLayout(false);
this.MenuStrip.ResumeLayout(false); this.MenuStrip.ResumeLayout(false);
this.MenuStrip.PerformLayout(); this.MenuStrip.PerformLayout();
this.ControlsPanel.ResumeLayout(false); this.ControlsPanel.ResumeLayout(false);
this.ControlsPanel.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.PositionTrackBar)).EndInit();
this.NotifyMenuStrip.ResumeLayout(false);
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();
@@ -208,11 +549,41 @@
private System.Windows.Forms.Panel MainPanel; private System.Windows.Forms.Panel MainPanel;
private System.Windows.Forms.MenuStrip MenuStrip; private System.Windows.Forms.MenuStrip MenuStrip;
private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem openToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem saveToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem viewToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem viewToolStripMenuItem;
private System.Windows.Forms.Panel ControlsPanel; private System.Windows.Forms.Panel ControlsPanel;
private System.Windows.Forms.Button PlayButton; private System.Windows.Forms.Button PlayButton;
private System.Windows.Forms.Button StopButton;
private System.Windows.Forms.Button PauseButton;
private System.Windows.Forms.Label BufferLabel;
private System.Windows.Forms.ProgressBar BufferBar;
private System.Windows.Forms.Timer UpdateTimer;
private System.Windows.Forms.TrackBar PositionTrackBar;
private System.Windows.Forms.Label LabelTotalTime;
private System.Windows.Forms.Label LabelCurrentTime;
private System.Windows.Forms.NotifyIcon NotifyIcon;
private System.Windows.Forms.Label CurrentSongLabel;
private System.Windows.Forms.Label SeperatorLabel;
private System.Windows.Forms.Label AlbumListLabel;
private System.Windows.Forms.Label ArtistListLabel;
private System.Windows.Forms.Label GenreListLabel;
private System.Windows.Forms.ToolStripMenuItem playlistsToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem overviewToolStripMenuItem;
public System.Windows.Forms.ListBox PlaylistBox;
private System.Windows.Forms.Label PlaylistListLabel;
private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem playlistToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem saveToolStripMenuItem1;
private System.Windows.Forms.ToolStripMenuItem loadToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
private System.Windows.Forms.ContextMenuStrip NotifyMenuStrip;
private System.Windows.Forms.ToolStripMenuItem NotifyMenuStripPlayButton;
private System.Windows.Forms.ToolStripMenuItem NotifyMenuStripPauseButton;
private System.Windows.Forms.ToolStripMenuItem NotifyMenuStripStopButton;
private System.Windows.Forms.ToolStripMenuItem NotifyMenuStripPlayingLabel;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
private System.Windows.Forms.ToolStripMenuItem NotifyMenuStripPlayingSongLabel;
private System.Windows.Forms.SplitContainer SplitContainer;
private System.Windows.Forms.ToolStripMenuItem makeToolStripMenuItem;
} }
} }
+249 -4
View File
@@ -7,6 +7,7 @@ using System.Drawing;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Net; using System.Net;
using System.Reflection;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
@@ -17,6 +18,8 @@ namespace MusicPlayer
{ {
public partial class MainForm : Form public partial class MainForm : Form
{ {
NotificationPopup p;
public Main main public Main main
{ {
get; set; get; set;
@@ -25,21 +28,263 @@ namespace MusicPlayer
public MainForm() public MainForm()
{ {
InitializeComponent(); InitializeComponent();
PositionTrackBar.Scroll += (s, e) =>
{
this.PositionTrackBar_ValueChanged();
};
PositionTrackBar.MouseDown += (s, e) =>
{
clicked = true;
};
PositionTrackBar.MouseUp += (s, e) =>
{
if (!clicked)
return;
clicked = false;
this.PositionTrackBar_ValueChanged();
};
p = new NotificationPopup(this);
} }
private void MainForm_Load(object sender, EventArgs e) private void MainForm_Load(object sender, EventArgs e)
{ {
UpdateTimer.Start();
} }
private void PlayButton_Click(object sender, EventArgs e) private void PlayButton_Click(object sender, EventArgs e)
{ {
AudioHandler.PlayMp3FromUrl("http://imegumii.nl/music/English/Monstercat/Direct%20-%20Eternity.mp3"); SongsTableView_CellDoubleClick(sender, new DataGridViewCellEventArgs(0, 0));
} }
private void SongsTableView_SelectionChanged(object sender, EventArgs e) private void PauseButton_Click(object sender, EventArgs e)
{ {
DataGridViewSelectedRowCollection col = SongsTableView.SelectedRows; main.audio.Pause();
}
private void StopButton_Click(object sender, EventArgs e)
{
main.audio.Stop();
}
private void UpdateTimer_Tick(object sender, EventArgs e)
{
//Trackbar
if (main.audio.BState == AudioHandler.BufferState.DONE)
PositionTrackBar.Enabled = true;
else
PositionTrackBar.Enabled = false;
if (!clicked)
PositionTrackBar.Value = main.audio.Position;
//Buffer display
BufferBar.Value = main.audio.Buffered / 10;
//Time labels
if (!clicked)
LabelCurrentTime.Text = Main.SecondsToTimestamp(main.audio.CurrentTime);
LabelTotalTime.Text = Main.SecondsToTimestamp(main.audio.TotalTime);
//Current song label
if (main.audio.CurrentSong == null)
CurrentSongLabel.Text = "Not playing any songs";
else
CurrentSongLabel.Text = "Currently playing: " + main.audio.CurrentSong.Name;
//Buttons and context menu
if (main.audio.AState == AudioHandler.AudioState.PLAYING)
{
PlayButton.Enabled = false;
NotifyMenuStripPlayButton.Enabled = false;
NotifyMenuStripPlayingLabel.Text = "Playing";
NotifyMenuStripPlayingLabel.Enabled = true;
NotifyMenuStripPlayingSongLabel.Visible = true;
NotifyMenuStripPlayingSongLabel.Text = main.audio.CurrentSong.Name;
}
else
{
PlayButton.Enabled = true;
NotifyMenuStripPlayButton.Enabled = true;
NotifyMenuStripPlayingSongLabel.Visible = false;
}
if (main.audio.AState == AudioHandler.AudioState.PAUSED)
{
PauseButton.Enabled = false;
NotifyMenuStripPauseButton.Enabled = false;
NotifyMenuStripPlayingLabel.Text = "Paused";
NotifyMenuStripPlayingLabel.Enabled = true;
NotifyMenuStripPlayingSongLabel.Visible = true;
NotifyMenuStripPlayingSongLabel.Text = main.audio.CurrentSong.Name;
}
else
{
PauseButton.Enabled = true;
NotifyMenuStripPauseButton.Enabled = true;
}
if (main.audio.AState == AudioHandler.AudioState.STOPPED)
{
StopButton.Enabled = false;
NotifyMenuStripStopButton.Enabled = false;
NotifyMenuStripPlayingLabel.Text = "Stopped";
NotifyMenuStripPlayingLabel.Enabled = false;
NotifyMenuStripPlayingSongLabel.Visible = false;
NotifyMenuStripPlayingSongLabel.Text = "Stopped";
}
else
{
StopButton.Enabled = true;
NotifyMenuStripStopButton.Enabled = true;
}
}
private void GenreListBox_SelectedIndexChanged(object sender, EventArgs e)
{
if (GenreListBox.SelectedItems.Count != 0)
{
main.GenreFilter(GenreListBox.SelectedItems[0].ToString());
ArtistListBox.ClearSelected();
PlaylistBox.ClearSelected();
AlbumListView.SelectedIndices.Clear();
}
}
private void PlaylistBox_SelectedIndexChanged(object sender, EventArgs e)
{
if (PlaylistBox.SelectedItems.Count != 0)
{
main.PlaylistFilter(PlaylistBox.SelectedItems[0].ToString());
GenreListBox.ClearSelected();
ArtistListBox.ClearSelected();
AlbumListView.SelectedIndices.Clear();
}
}
private void ArtistListBox_SelectedIndexChanged(object sender, EventArgs e)
{
if (ArtistListBox.SelectedItems.Count != 0)
{
main.ArtistFilter(ArtistListBox.SelectedItems[0].ToString());
GenreListBox.ClearSelected();
PlaylistBox.ClearSelected();
AlbumListView.SelectedIndices.Clear();
}
}
private void AlbumListView_SelectedIndexChanged(object sender, EventArgs e)
{
if (AlbumListView.SelectedItems.Count != 0)
{
main.AlbumFilter(AlbumListView.SelectedItems[0].Text);
PlaylistBox.ClearSelected();
ArtistListBox.ClearSelected();
GenreListBox.ClearSelected();
}
}
private void SongsTableView_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
{
SongsTable s = new SongsTable();
if (SongsTableView.SelectedRows.Count > 0)
{
var drv = SongsTableView.SelectedRows[0].DataBoundItem as DataRowView;
var row = drv.Row as DataRow;
s.ImportRow(row);
main.audio.Play((s.Rows[0][5] as Song));
}
}
private void PositionTrackBar_ValueChanged()
{
if (!clicked)
main.audio.Seek(PositionTrackBar.Value);
LabelCurrentTime.Text = Main.SecondsToTimestamp((int)(((double)PositionTrackBar.Value / 1000) * main.audio.CurrentSong.Seconds));
}
private void NotifyIcon_Click(object sender, MouseEventArgs e)
{
/*
if (p.Visible)
p.Visible = false;
else
p.Visible = true;
*/
if (e.Button == MouseButtons.Left)
{
MethodInfo mi = typeof(NotifyIcon).GetMethod("ShowContextMenu", BindingFlags.Instance | BindingFlags.NonPublic);
mi.Invoke(NotifyIcon, null);
}
}
private void overviewToolStripMenuItem_Click(object sender, EventArgs e)
{
this.PlaylistBox.Visible = false;
this.GenreListBox.Visible = true;
this.ArtistListBox.Visible = true;
this.AlbumListView.Visible = true;
this.GenreListLabel.Visible = true;
this.AlbumListLabel.Visible = true;
this.ArtistListLabel.Visible = true;
this.PlaylistListLabel.Visible = false;
}
private void playlistsToolStripMenuItem_Click(object sender, EventArgs e)
{
this.PlaylistBox.Visible = true;
this.GenreListBox.Visible = false;
this.ArtistListBox.Visible = false;
this.AlbumListView.Visible = false;
this.GenreListLabel.Visible = false;
this.AlbumListLabel.Visible = false;
this.ArtistListLabel.Visible = false;
this.PlaylistListLabel.Visible = true;
}
private void exitToolStripMenuItem_Click(object sender, EventArgs e)
{
ExitProgram();
}
private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
{
ExitProgram();
}
private void ExitProgram()
{
main.audio.AState = AudioHandler.AudioState.STOPPED;
NotifyIcon.Visible = false;
NotifyIcon.Icon = null;
System.Windows.Forms.Application.Exit();
}
private void NotifyMenuStripPlayButton_Click(object sender, EventArgs e)
{
PlayButton_Click(sender, e);
}
private void NotifyMenuStripPauseButton_Click(object sender, EventArgs e)
{
PauseButton_Click(sender, e);
}
private void NotifyMenuStripStopButton_Click(object sender, EventArgs e)
{
StopButton_Click(sender, e);
}
private void makeToolStripMenuItem_Click(object sender, EventArgs e)
{
PlaylistMaker p = new PlaylistMaker(main.pl, main.api);
p.ShowDialog();
main.Repopulate();
} }
} }
} }
File diff suppressed because it is too large Load Diff
+15
View File
@@ -55,6 +55,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="AudioHandler.cs" /> <Compile Include="AudioHandler.cs" />
<Compile Include="Genre.cs" />
<Compile Include="Main.cs" /> <Compile Include="Main.cs" />
<Compile Include="MainForm.cs"> <Compile Include="MainForm.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
@@ -72,6 +73,14 @@
<Compile Include="NotificationPopup.Designer.cs"> <Compile Include="NotificationPopup.Designer.cs">
<DependentUpon>NotificationPopup.cs</DependentUpon> <DependentUpon>NotificationPopup.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="Playlist.cs" />
<Compile Include="PlaylistHandler.cs" />
<Compile Include="PlaylistMaker.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="PlaylistMaker.Designer.cs">
<DependentUpon>PlaylistMaker.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" /> <Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Song.cs" /> <Compile Include="Song.cs" />
@@ -85,6 +94,9 @@
<EmbeddedResource Include="NotificationPopup.resx"> <EmbeddedResource Include="NotificationPopup.resx">
<DependentUpon>NotificationPopup.cs</DependentUpon> <DependentUpon>NotificationPopup.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="PlaylistMaker.resx">
<DependentUpon>PlaylistMaker.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx"> <EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator> <Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput> <LastGenOutput>Resources.Designer.cs</LastGenOutput>
@@ -108,6 +120,9 @@
<ItemGroup> <ItemGroup>
<None Include="App.config" /> <None Include="App.config" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Folder Include="Resources\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets. Other similar extension points exist, see Microsoft.Common.targets.
View File
+28 -14
View File
@@ -30,18 +30,21 @@
{ {
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(NotificationPopup)); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(NotificationPopup));
this.groupBox1 = new System.Windows.Forms.GroupBox(); this.groupBox1 = new System.Windows.Forms.GroupBox();
this.pictureBox1 = new System.Windows.Forms.PictureBox(); this.pictureBox4 = new System.Windows.Forms.PictureBox();
this.pictureBox2 = new System.Windows.Forms.PictureBox();
this.pictureBox3 = new System.Windows.Forms.PictureBox(); this.pictureBox3 = new System.Windows.Forms.PictureBox();
this.pictureBox2 = new System.Windows.Forms.PictureBox();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.groupBox1.SuspendLayout(); this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
// //
// groupBox1 // groupBox1
// //
this.groupBox1.BackColor = System.Drawing.Color.White; this.groupBox1.BackColor = System.Drawing.Color.White;
this.groupBox1.Controls.Add(this.pictureBox4);
this.groupBox1.Controls.Add(this.pictureBox3); this.groupBox1.Controls.Add(this.pictureBox3);
this.groupBox1.Controls.Add(this.pictureBox2); this.groupBox1.Controls.Add(this.pictureBox2);
this.groupBox1.Controls.Add(this.pictureBox1); this.groupBox1.Controls.Add(this.pictureBox1);
@@ -49,11 +52,18 @@
this.groupBox1.Name = "groupBox1"; this.groupBox1.Name = "groupBox1";
this.groupBox1.TabStop = false; this.groupBox1.TabStop = false;
// //
// pictureBox1 // pictureBox4
// //
resources.ApplyResources(this.pictureBox1, "pictureBox1"); resources.ApplyResources(this.pictureBox4, "pictureBox4");
this.pictureBox1.Name = "pictureBox1"; this.pictureBox4.Name = "pictureBox4";
this.pictureBox1.TabStop = false; this.pictureBox4.TabStop = false;
this.pictureBox4.Click += new System.EventHandler(this.pictureBox4_Click);
//
// pictureBox3
//
resources.ApplyResources(this.pictureBox3, "pictureBox3");
this.pictureBox3.Name = "pictureBox3";
this.pictureBox3.TabStop = false;
// //
// pictureBox2 // pictureBox2
// //
@@ -61,11 +71,11 @@
this.pictureBox2.Name = "pictureBox2"; this.pictureBox2.Name = "pictureBox2";
this.pictureBox2.TabStop = false; this.pictureBox2.TabStop = false;
// //
// pictureBox3 // pictureBox1
// //
resources.ApplyResources(this.pictureBox3, "pictureBox3"); resources.ApplyResources(this.pictureBox1, "pictureBox1");
this.pictureBox3.Name = "pictureBox3"; this.pictureBox1.Name = "pictureBox1";
this.pictureBox3.TabStop = false; this.pictureBox1.TabStop = false;
// //
// NotificationPopup // NotificationPopup
// //
@@ -79,10 +89,13 @@
this.Name = "NotificationPopup"; this.Name = "NotificationPopup";
this.ShowIcon = false; this.ShowIcon = false;
this.ShowInTaskbar = false; this.ShowInTaskbar = false;
this.Shown += new System.EventHandler(this.NotificationPopup_Shown);
this.Leave += new System.EventHandler(this.NotificationPopup_Leave);
this.groupBox1.ResumeLayout(false); this.groupBox1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.ResumeLayout(false); this.ResumeLayout(false);
} }
@@ -93,5 +106,6 @@
private System.Windows.Forms.PictureBox pictureBox3; private System.Windows.Forms.PictureBox pictureBox3;
private System.Windows.Forms.PictureBox pictureBox2; private System.Windows.Forms.PictureBox pictureBox2;
private System.Windows.Forms.PictureBox pictureBox1; private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.PictureBox pictureBox4;
} }
} }
+21 -1
View File
@@ -12,9 +12,29 @@ namespace MusicPlayer
{ {
public partial class NotificationPopup : Form public partial class NotificationPopup : Form
{ {
public NotificationPopup() MainForm f;
public NotificationPopup(MainForm f)
{ {
InitializeComponent(); InitializeComponent();
this.f = f;
}
private void NotificationPopup_Shown(object sender, EventArgs e)
{
System.Drawing.Rectangle workingRectangle = Screen.PrimaryScreen.WorkingArea;
this.Left = workingRectangle.Width - this.Width -10;
this.Top = workingRectangle.Height - this.Height -10;
this.Show();
}
private void pictureBox4_Click(object sender, EventArgs e)
{
f.WindowState = FormWindowState.Normal;
}
private void NotificationPopup_Leave(object sender, EventArgs e)
{
this.Visible = false;
} }
} }
} }
+72 -35
View File
@@ -118,21 +118,60 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="pictureBox3.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="pictureBox4.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value> <value>
iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAL
YQUAAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQffCh0UITh4zTVoAAABr0lEQVRYR8WXQW7CMBRE EwAACxMBAJqcGAAAAcVJREFUWEftlWlOwzAQhSvBvXqBxE6AsF6Fnb9IRaq4AQK1qBywRSpv7HGapON4
wxVY9AA9D0k4QXqCrqqqaqtKPQOVWHOgcgyWHIHCjPmmcRjiOInISE8B/+/xF9ixnaWoKJYVWINfsAcH +Uuf9KTW45n5so0nSlXbBD9MAipL/SjkeZ0CcM89gkqBiAJAwTuuHa1YiBiAW66ZrBiIAIBacK1sKaVX
g5/Zxlhl6eMIhnOwAcdE2GduNmlCR/9cmdkQVnXPqJA4Aw9gB5RhH+hFz5kNo8UE8AiUyRjQWxeBAGGV cm3rUYCiUL9a6wuulSyl6huqIdV2Dj6CXIiY5mQBQC2GiakQnuYbPI7lYG0PwLxw1CwXwte8KPQpxYcv
quOYcAwbtSEExvzZb7Gz4UIh0HfC/Ym2GG5iXoQGLjWVGONJtHXlf4niS/I6z/Pli/WV8Q5s3OCUCMZ4 Zgsw/NTKsjrHOqh3m+EZh73CVc67OYBZo9YJh426EA5AHDK4mgYxA4EreOPloLD/3eaoNR5pzcs9OQja
ta5DCjh6A75eZcIN3lxHk4inUNGA728VVLzbuBeJnBTWNOAmooINyk8bM5DODWhbJVsacCdTwTpfNl4g PDpeUeAMe175b7SQM/M1dyII/nnQQQf9Z4WGAWbJJfZ8NE1zxEtBTafTY0zOLxpivCTK9KZx6IPADL/a
tLe/WqGGT5M9E7idqqDn6mdPkfCrc4gWkOflh3n1kvKs4QqI/gUo4tv8AiE2yl/QaRK2FCHza0QnYedl HSxqQYU55BXtQd63zaExXjcc6gk9n2iPASAPIXDyXe+fauqTw17ZK+/mVBs62DhshLVnF28ByA4C1J7z
qIpQeQm4ZZj0ImoWoXISOJ8fRaCVehEq3hWzcCY9NqNzESrWkWAz6rkdl8+6Pc5iUYQnZjTe80DyY8OG fPyWkuiK7d5+roNAj5durAdgrVe5zZ2omc3Z1aCaWP/prpEFgD0nNXeSICSHALKaOxGEcDd7DgDoJdfK
QmDSIxmZ/FA63bHciwmAVd7/YuKFRP8c42rmJhyezjNZ6Nj7cnq11IYKpv56vgXN6znbEq/nWXYCplmG lnTbuw4+At8nGqPhCyc55h3IgkBe+6mNOQqAnAKBvWbIxDgagBwDQXukXNnV9g9jjBoLjmDoxgAAAABJ
3mQZHZoAAAAASUVORK5CYII= RU5ErkJggg==
</value> </value>
</data> </data>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="pictureBox4.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="pictureBox4.Location" type="System.Drawing.Point, System.Drawing">
<value>227, 158</value>
</data>
<data name="pictureBox4.Size" type="System.Drawing.Size, System.Drawing">
<value>33, 32</value>
</data>
<assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="pictureBox4.TabIndex" type="System.Int32, mscorlib">
<value>3</value>
</data>
<data name="&gt;&gt;pictureBox4.Name" xml:space="preserve">
<value>pictureBox4</value>
</data>
<data name="&gt;&gt;pictureBox4.Type" xml:space="preserve">
<value>System.Windows.Forms.PictureBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;pictureBox4.Parent" xml:space="preserve">
<value>groupBox1</value>
</data>
<data name="&gt;&gt;pictureBox4.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="pictureBox3.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAL
EwAACxMBAJqcGAAAAAd0SU1FB98KHRQhOHjNNWgAAAGvSURBVFhHxZdBbsIwFETDFVj0AD0PSThBeoKu
qqpqq0o9A5VYc6ByDJYcgcKM+aZxGOI4ichITwH/7/EX2LGdpagolhVYg1+wBweDn9nGWGXp4wiGc7AB
x0TYZ242aUJH/1yZ2RBWdc+okDgDD2AHlGEf6EXPmQ2jxQTwCJTJGNBbF4EAYZWq45hwDBu1IQTG/Nlv
sbPhQiHQd8L9ibYYbmJehAYuNZUY40m0deV/ieJL8jrP8+WL9ZXxDmzc4JQIxni1rkMKOHoDvl5lwg3e
XEeTiKdQ0YDvbxVUvNu4F4mcFNY04Caigg3KTxszkM4NaFslWxpwJ1PBOl82XiC0t79aoYZPkz0TuJ2q
oOfqZ0+R8KtziBaQ5+WHefWS8qzhCoj+BSji2/wCITbKX9BpErYUIfNrRCdh52WoilB5CbhlmPQiahah
chI4nx9FoJV6ESreFbNwJj02o3MRKtaRYDPquR2Xz7o9zmJRhCdmNN7zQPJjw4ZCYNIjGZn8UDrdsdyL
CYBV3v9i4oVE/xzjauYmHJ7OM1no2PtyerXUhgqm/nq+Bc3rOdsSr+dZdgKmWYbeZBkdmgAAAABJRU5E
rkJggg==
</value>
</data>
<data name="pictureBox3.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms"> <data name="pictureBox3.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value> <value>NoControl</value>
</data> </data>
@@ -142,7 +181,6 @@
<data name="pictureBox3.Size" type="System.Drawing.Size, System.Drawing"> <data name="pictureBox3.Size" type="System.Drawing.Size, System.Drawing">
<value>33, 32</value> <value>33, 32</value>
</data> </data>
<assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="pictureBox3.TabIndex" type="System.Int32, mscorlib"> <data name="pictureBox3.TabIndex" type="System.Int32, mscorlib">
<value>2</value> <value>2</value>
</data> </data>
@@ -156,20 +194,20 @@
<value>groupBox1</value> <value>groupBox1</value>
</data> </data>
<data name="&gt;&gt;pictureBox3.ZOrder" xml:space="preserve"> <data name="&gt;&gt;pictureBox3.ZOrder" xml:space="preserve">
<value>0</value> <value>1</value>
</data> </data>
<data name="pictureBox2.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="pictureBox2.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value> <value>
iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAL
YQUAAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQffCh0UIRU9EmkdAAABx0lEQVRYR81XS26DMBDl EwAACxMBAJqcGAAAAAd0SU1FB98KHRQhFT0SaR0AAAHHSURBVFhHzVdLboMwEOUQkZJ1pd6guQbQLsq1
EJGSdaXeoLkG0C7KtZIDZJWTdNlK6S2yzA2atu8NM9S4JnyMS5/0NMYzfjOAMXbWh6IotcX2YwUewHfw kgNklZN02UrpLbLMDZq27w0z1LgmfIxLn/Q0xjN+M4AxdtaHoii1xfZjBR7Ad/ACXpVss4++SsMZr60J
Al6VbLOPvkrDGa+tCbDBsBvwCH6NJMdsqJHnPzcxCBhodqdiMdy7mr1gILgCz2BIcAqptSrLJ83SAQSR sMGwG/AIfo0kx2yokec/NzEIGGh2p2Ix3LuavWAguALPYEhwCqm1KssnzdIBBJF3IN9rSCiG1IR2RxFw
dyDfa0gohtSEdkcRcNqdp0hupDZzaFZFnjfvfM7H3sVzndObmHDcmnCfgb4Y7jRt8+j5qYUCXd6Db15f 2p2nSG6kNnNoVkWeN+98zsfexXOd05uYcNyacJ+BvhjuNG3z6PmphQJd3oNvXl8M181TwEXvd15HSuwW
DNfNU8BF73deR0rsFpyjkKNKimgooEUNlSemloW8mn8KTYjLazDApQQ7QJ/ZmEIqCnD9DjlblGwBwGd2 nKOQo0qKaCigRQ2VJ6aWhbyafwpNiMtrMMClBDtAn9mYQioKcP0OOVuUbAHAZ3ZKIQcO5E8k5GxRstwA
SiEHDuRPJORsUbLcAGLMjinkxAH8k4WcLYr6ACDW7APYV8iFgYNWPlEdAYwxyyfyYjoer/+igFSvYMhc YsyOKeTEAfyThZwtivoAINbsA9hXyIWBg1Y+UR0BjDHLJ/JiOh6v/6KAVK9gyFyQV7D4JFz8M1xyIXo2
kFew+CRc/DNcciF6NpGQs0UJBNA2G5NYKEIELpb7GaFBLvI7BqUGAS72jtNnug0JYRsDOP5sS1YUheRs kZCzRQkE0DYbk1goQgQulvsZoUEu8jsGpQYBLvaO02e6DQlhGwM4/mxLVhSF5GwAB5l6U/oB/t6UGrhl
AAeZelP6Af7elBq4ZYYz1bacyamt2TqgRSQ5mICapQcWCDvH0UwmHKxoDoZzVuDnMvVwuq41vAk3Bu4B hjPVtpzJqa3ZOqBFJDmYgJqlBxYIO8fRTCYcrGgOhnNW4Ocy9XC6rjW8CTcG7gECgnY8P4H+8Zx99NXL
AoJ2PD+B/vGcffTVyyuAtra6kGXfchVyMfY7IlMAAAAASUVORK5CYII= K4C2trqQZd9yFXIx9jsiUwAAAABJRU5ErkJggg==
</value> </value>
</data> </data>
<data name="pictureBox2.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms"> <data name="pictureBox2.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
@@ -194,20 +232,19 @@
<value>groupBox1</value> <value>groupBox1</value>
</data> </data>
<data name="&gt;&gt;pictureBox2.ZOrder" xml:space="preserve"> <data name="&gt;&gt;pictureBox2.ZOrder" xml:space="preserve">
<value>1</value> <value>2</value>
</data> </data>
<data name="pictureBox1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="pictureBox1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value> <value>
iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAL
YQUAAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQffCh0UHx1yDPpSAAABo0lEQVRYR8WXTW7CMBCF EwAACxMBAJqcGAAAAAd0SU1FB98KHRQfHXIM+lIAAAGjSURBVFhHxZdNbsIwEIXDFVj0AD0PhJwgPUFX
wxVY9AA9D4ScID1BV1VVFVSpZ6ASaw5Ej8GSI1D63nRME2si/8SQJ30ieMbPI7Bju0pRXTct2IFvcAJn VVUVVKlnoBJrDkSPwZIjUPredEwTayL/xJAnfSJ4xs8jsGO7SlFdNy3YgW9wAmeFz2xjrNX0Mlos6jlM
hc9sY6zV9DJaLOo5TPfgkgj7zNUmTejoPr/UbAzbrmdQSJyBB3AElmEO9KLnTIexxQTwCCyTEtDbLgIB 9+CSCPvM1SZN6Og+v9RsDNuuZ1BInIEHcASWYQ70oudMh7HFBPAILJMS0NsuAgHCKq2OJeEYOqonBEr+
wiqtjiXhGDqqJwRK/uxDHHW4vhDImXA/RlsMMjGv0qVmJUawerbbg/wvUXzJWecC+y+Xq08rFmAvg1NG 7EMcdbi+EMiZcD9GWwwyMa/SpWYlRrB6ttuD/C9RfMlZ5wL7L5erTysWYC+DU0YwGrXIKkI64oGvVzMh
MBq1yCpCOuKBr1czIQYxUWUU0bIAvr+tYBQ69lWJRexYADcRK0iCs1zH7SmhiAML4E5mBQX1HBRyzDdb BjFRZRTRsgC+v61gFDr2VYlF7FgANxErSIKzXMftKaGIAwvgTmYFBfUcFHLMN1tkEScacDu1goL6ZQlF
ZBEnGnA7tYKC+mUJRawtzw7nmxaA/u++n4cUcJO/AO0fXZ8B5C8oPgnxdtxYuQYyCYsuQ7SFfvYusgyL rC3PDuebFoD+776fhxRwk78A7R9dnwHkLyg+CfF23Fi5BjIJiy5DtIV+9i6yDIu9iPD9zY8H+Ds/GoFo
vYjw/c2PB/g7PxqBaMQAwvOrHwuhXaXzyM2oebFiAXqb0YjtuHky2mLon5jRsPUSYihzIHFCYNIjGZn8 xADC86sfC6FdpfPIzah5sWIBepvRiO24eTLaYuifmNGw9RJiKHMgcUJg0iMZmfxQOt2x3IkJgFXe/2Li
UDrdsdyJCYBV3v9i4oRE95kzMX3Srma+0PH+l9MhwdBdzw/Av56zLfF6XlW/G66G3g3Cfq0AAAAASUVO hET3mTMxfdKuZr7Q8f6X0yHB0F3PD8C/nrMt8XpeVb8brobeDcJ+rQAAAABJRU5ErkJggg==
RK5CYII=
</value> </value>
</data> </data>
<data name="pictureBox1.Location" type="System.Drawing.Point, System.Drawing"> <data name="pictureBox1.Location" type="System.Drawing.Point, System.Drawing">
@@ -229,7 +266,7 @@
<value>groupBox1</value> <value>groupBox1</value>
</data> </data>
<data name="&gt;&gt;pictureBox1.ZOrder" xml:space="preserve"> <data name="&gt;&gt;pictureBox1.ZOrder" xml:space="preserve">
<value>2</value> <value>3</value>
</data> </data>
<data name="groupBox1.Location" type="System.Drawing.Point, System.Drawing"> <data name="groupBox1.Location" type="System.Drawing.Point, System.Drawing">
<value>12, 12</value> <value>12, 12</value>
+68
View File
@@ -0,0 +1,68 @@
using System;
using System.Collections.Generic;
using System.IO;
namespace MusicPlayer
{
public class Playlist
{
public string name { get; }
private string basedir;
public List<Song> songs;
private APIHandler api;
public Playlist(string name, string basedir, APIHandler api)
{
this.songs = new List<Song>();
this.name = name;
this.api = api;
this.basedir = basedir;
this.ReadFromFile();
}
public void AddSong(Song s)
{
this.songs.Add(s);
}
public List<Song> 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"))
{
this.songs.ForEach(s =>
{
stw.WriteLine(s.ToString());
});
stw.Flush();
}
}
}
}
@@ -0,0 +1,60 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
namespace MusicPlayer
{
public class PlaylistHandler
{
private List<Playlist> playlists;
private APIHandler api;
private readonly string basedir = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\.mpplaylists\\";
public PlaylistHandler(APIHandler api)
{
this.playlists = new List<Playlist>();
this.api = api;
Populate();
}
private void Populate()
{
try {
Directory.GetFiles(basedir).ToList().ForEach(f =>
{
if (f.EndsWith(".txt"))
{
playlists.Add(new Playlist(Path.GetFileName(f.Replace(".txt","")) ,basedir, api));
}
});
}
catch (DirectoryNotFoundException)
{
Directory.CreateDirectory(basedir);
Populate();
}
}
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<Playlist> GetPlaylists()
{
return playlists;
}
}
}
+121
View File
@@ -0,0 +1,121 @@
using System.Windows.Forms;
namespace MusicPlayer
{
partial class PlaylistMaker
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
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;
}
}
+86
View File
@@ -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<Song> allPlaylistSongs;
private List<Song> allsongs;
public PlaylistMaker(PlaylistHandler pl, APIHandler api)
{
this.pl = pl;
this.api = api;
this.allPlaylistSongs = new List<Song>();
this.allsongs = new List<Song>();
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();
}
}
}
+120
View File
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
+2 -17
View File
@@ -19,24 +19,9 @@ namespace MusicPlayer
NetworkHandler nw = new NetworkHandler("http://www.imegumii.nl"); NetworkHandler nw = new NetworkHandler("http://www.imegumii.nl");
APIHandler api = new APIHandler(nw); APIHandler api = new APIHandler(nw);
// api.GetSongsByArtist("Amon Amarth").ForEach(s =>
// {
// Console.WriteLine(s.SongID);
// });
// api.GetSongsByYear("2009").ForEach(s =>
// {
// Console.WriteLine(s.Name);
// });
api.GetSongsByGenre("Melodic Death Metal").ForEach(s =>
{
Console.WriteLine(s.Name);
});
// api.GetSongsByAlbum("Stronger").ForEach(s =>
// {
// Console.WriteLine(s.Name);
// });
MainForm form = new MainForm(); MainForm form = new MainForm();
new Main(nw, api, form); PlaylistHandler pl = new PlaylistHandler(api);
new Main(nw, api, form,pl);
Application.Run(form); Application.Run(form);
} }
View File
View File
View File
View File
View File
Regular → Executable
+10 -1
View File
@@ -12,18 +12,22 @@ namespace MusicPlayer
public string Name { get; set; } public string Name { get; set; }
public string Album { get; set; } public string Album { get; set; }
public string Artist { get; set; } public string Artist { get; set; }
public string Genre { get; set; }
public string Url { get { return GetURL(); } set { SetURL(value); } } public string Url { get { return GetURL(); } set { SetURL(value); } }
public int Seconds { get; set; }
private APIHandler api; private APIHandler api;
private string url; private string url;
public Song(string songid, string name, string album, string artist, APIHandler api) public Song(string songid, string name, string album, string artist, string genre, int seconds, APIHandler api)
{ {
SongID = songid; SongID = songid;
Name = name; Name = name;
Album = album; Album = album;
Artist = artist; Artist = artist;
Seconds = seconds;
Genre = genre;
this.api = api; this.api = api;
@@ -44,5 +48,10 @@ namespace MusicPlayer
{ {
url = str; url = str;
} }
public override string ToString()
{
return $"{this.SongID}|{this.Name}|{this.Album}|{this.Artist}|{this.Genre}|{this.Seconds}";
}
} }
} }
+4 -1
View File
@@ -15,11 +15,14 @@ namespace MusicPlayer
this.Columns.Add("Naam", typeof(string)); this.Columns.Add("Naam", typeof(string));
this.Columns.Add("Album", typeof(string)); this.Columns.Add("Album", typeof(string));
this.Columns.Add("Artiest", typeof(string)); this.Columns.Add("Artiest", typeof(string));
this.Columns.Add("Genre", typeof(string));
this.Columns.Add("Duration", typeof(string));
this.Columns.Add("song", typeof(Song));
} }
public void Add(Song s) public void Add(Song s)
{ {
this.Rows.Add(s.Name, s.Album, s.Artist); this.Rows.Add(s.Name, s.Album, s.Artist, s.Genre, Main.SecondsToTimestamp(s.Seconds), s);
} }
} }
Regular → Executable
View File
View File
Regular → Executable
View File