From e6d4eacd1c9f42ebed8a10e924bd445d0dd0f56b Mon Sep 17 00:00:00 2001 From: Kenneth van Ewijk Date: Fri, 30 Oct 2015 15:14:32 +0100 Subject: [PATCH] Fix seeking after SOMEONE broke it :p --- MusicPlayer/MusicPlayer/MainForm.cs | 34 ++++++++++++++++--- .../MusicPlayer/NotificationPopup.Designer.cs | 21 ++++++------ MusicPlayer/MusicPlayer/NotificationPopup.cs | 5 +++ .../MusicPlayer/NotificationPopup.resx | 20 +++++------ 4 files changed, 55 insertions(+), 25 deletions(-) diff --git a/MusicPlayer/MusicPlayer/MainForm.cs b/MusicPlayer/MusicPlayer/MainForm.cs index fa563b7..65a27ec 100644 --- a/MusicPlayer/MusicPlayer/MainForm.cs +++ b/MusicPlayer/MusicPlayer/MainForm.cs @@ -26,6 +26,26 @@ namespace MusicPlayer public MainForm() { InitializeComponent(); + + PositionTrackBar.Scroll += (s, e) => + { + if (clicked) + return; + 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); } @@ -81,11 +101,15 @@ namespace MusicPlayer private void SongsTableView_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { SongsTable s = new SongsTable(); - var drv = SongsTableView.SelectedRows[0].DataBoundItem as DataRowView; - var row = drv.Row as DataRow; - s.ImportRow(row); - System.Console.WriteLine((s.Rows[0][3] as Song).SongID); - main.audio.Play((s.Rows[0][3] as Song)); + if(SongsTableView.SelectedRows.Count > 0) + { + var drv = SongsTableView.SelectedRows[0].DataBoundItem as DataRowView; + var row = drv.Row as DataRow; + s.ImportRow(row); + System.Console.WriteLine((s.Rows[0][3] as Song).SongID); + main.audio.Play((s.Rows[0][3] as Song)); + } + } private void PositionTrackBar_ValueChanged() diff --git a/MusicPlayer/MusicPlayer/NotificationPopup.Designer.cs b/MusicPlayer/MusicPlayer/NotificationPopup.Designer.cs index d733917..2e4d065 100644 --- a/MusicPlayer/MusicPlayer/NotificationPopup.Designer.cs +++ b/MusicPlayer/MusicPlayer/NotificationPopup.Designer.cs @@ -30,15 +30,15 @@ { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(NotificationPopup)); this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.pictureBox4 = 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.pictureBox4 = new System.Windows.Forms.PictureBox(); this.groupBox1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).BeginInit(); this.SuspendLayout(); // // groupBox1 @@ -52,6 +52,13 @@ this.groupBox1.Name = "groupBox1"; this.groupBox1.TabStop = false; // + // pictureBox4 + // + resources.ApplyResources(this.pictureBox4, "pictureBox4"); + this.pictureBox4.Name = "pictureBox4"; + this.pictureBox4.TabStop = false; + this.pictureBox4.Click += new System.EventHandler(this.pictureBox4_Click); + // // pictureBox3 // resources.ApplyResources(this.pictureBox3, "pictureBox3"); @@ -70,13 +77,6 @@ this.pictureBox1.Name = "pictureBox1"; this.pictureBox1.TabStop = false; // - // pictureBox4 - // - resources.ApplyResources(this.pictureBox4, "pictureBox4"); - this.pictureBox4.Name = "pictureBox4"; - this.pictureBox4.TabStop = false; - this.pictureBox4.Click += new System.EventHandler(this.pictureBox4_Click); - // // NotificationPopup // resources.ApplyResources(this, "$this"); @@ -90,11 +90,12 @@ this.ShowIcon = false; this.ShowInTaskbar = false; this.Shown += new System.EventHandler(this.NotificationPopup_Shown); + this.Leave += new System.EventHandler(this.NotificationPopup_Leave); this.groupBox1.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).EndInit(); this.ResumeLayout(false); } diff --git a/MusicPlayer/MusicPlayer/NotificationPopup.cs b/MusicPlayer/MusicPlayer/NotificationPopup.cs index 0a0685e..28c31c8 100644 --- a/MusicPlayer/MusicPlayer/NotificationPopup.cs +++ b/MusicPlayer/MusicPlayer/NotificationPopup.cs @@ -31,5 +31,10 @@ namespace MusicPlayer { f.WindowState = FormWindowState.Normal; } + + private void NotificationPopup_Leave(object sender, EventArgs e) + { + this.Visible = false; + } } } diff --git a/MusicPlayer/MusicPlayer/NotificationPopup.resx b/MusicPlayer/MusicPlayer/NotificationPopup.resx index 843ee94..4a1b2ed 100644 --- a/MusicPlayer/MusicPlayer/NotificationPopup.resx +++ b/MusicPlayer/MusicPlayer/NotificationPopup.resx @@ -120,16 +120,16 @@ - iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAJcEhZcwAACxMAAAsTAQCanBgAAAHFSURBVFhH7ZVpTsMwEIUrwb16gcROgLBehZ2/SEWquAEC - tagcsEUqb+xxmqTjePlLn/Sk1uOZ+bKNJ0pV2wQ/TAIqS/0o5HmdAnDPPYJKgYgCQME7rh2tWIgYgFuu - mawYiACAWnCtbCmlV3Jt61GAolC/WusLrpUspeobqiHVdg4+glyImOZkAUAthompEJ7mGzyO5WBtD8C8 - cNQsF8LXvCj0KcWHL2YLMPzUyrI6xzqod5vhGYe9wlXOuzmAWaPWCYeNuhAOQBwyuJoGMQOBK3jj5a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