diff --git a/MusicPlayer/MusicPlayer/MainForm.Designer.cs b/MusicPlayer/MusicPlayer/MainForm.Designer.cs index e70a4a5..221b0d9 100644 --- a/MusicPlayer/MusicPlayer/MainForm.Designer.cs +++ b/MusicPlayer/MusicPlayer/MainForm.Designer.cs @@ -36,11 +36,11 @@ this.ArtistListBox = new System.Windows.Forms.ListBox(); 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.PlaylistBox = new System.Windows.Forms.ListBox(); this.MenuStrip = new System.Windows.Forms.MenuStrip(); this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); @@ -186,6 +186,16 @@ 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; + // // PlaylistListLabel // this.PlaylistListLabel.AutoSize = true; @@ -223,16 +233,6 @@ this.GenreListLabel.TabIndex = 4; this.GenreListLabel.Text = "Genre"; // - // 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; - // // MenuStrip // this.MenuStrip.BackColor = System.Drawing.SystemColors.WindowFrame; @@ -439,7 +439,7 @@ this.NotifyIcon.Icon = ((System.Drawing.Icon)(resources.GetObject("NotifyIcon.Icon"))); this.NotifyIcon.Text = "NotifyIcon"; this.NotifyIcon.Visible = true; - this.NotifyIcon.Click += new System.EventHandler(this.NotifyIcon_Click); + this.NotifyIcon.MouseUp += new System.Windows.Forms.MouseEventHandler(this.NotifyIcon_Click); // // NotifyMenuStrip // diff --git a/MusicPlayer/MusicPlayer/MainForm.cs b/MusicPlayer/MusicPlayer/MainForm.cs index 0a8bd1b..c906936 100644 --- a/MusicPlayer/MusicPlayer/MainForm.cs +++ b/MusicPlayer/MusicPlayer/MainForm.cs @@ -7,6 +7,7 @@ using System.Drawing; using System.IO; using System.Linq; using System.Net; +using System.Reflection; using System.Text; using System.Threading; using System.Threading.Tasks; @@ -191,7 +192,7 @@ namespace MusicPlayer LabelCurrentTime.Text = Main.SecondsToTimestamp((int)(((double)PositionTrackBar.Value / 1000) * main.audio.CurrentSong.Seconds)); } - private void NotifyIcon_Click(object sender, EventArgs e) + private void NotifyIcon_Click(object sender, MouseEventArgs e) { /* if (p.Visible) @@ -199,6 +200,12 @@ namespace MusicPlayer 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)