Selaa lähdekoodia

Fix seeking after SOMEONE broke it :p

Kenneth van Ewijk 10 vuotta sitten
vanhempi
commit
e6d4eacd1c

+ 29 - 5
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()

+ 11 - 10
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);
 
         }

+ 5 - 0
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;
+        }
     }
 }

+ 10 - 10
MusicPlayer/MusicPlayer/NotificationPopup.resx

@@ -120,16 +120,16 @@
   <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
   <data name="pictureBox4.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
     <value>
-        iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
-        YQUAAAAJcEhZcwAACxMAAAsTAQCanBgAAAHFSURBVFhH7ZVpTsMwEIUrwb16gcROgLBehZ2/SEWquAEC
-        tagcsEUqb+xxmqTjePlLn/Sk1uOZ+bKNJ0pV2wQ/TAIqS/0o5HmdAnDPPYJKgYgCQME7rh2tWIgYgFuu
-        mawYiACAWnCtbCmlV3Jt61GAolC/WusLrpUspeobqiHVdg4+glyImOZkAUAthompEJ7mGzyO5WBtD8C8
-        cNQsF8LXvCj0KcWHL2YLMPzUyrI6xzqod5vhGYe9wlXOuzmAWaPWCYeNuhAOQBwyuJoGMQOBK3jj5aCw
-        /93mqDUeac3LPTkI2jw6XlHgDHte+W+0kDPzNXciCP550EEH/WeFhgFmySX2fDRNc8RLQU2n02NMzi8a
-        YrwkyvSmceiDwAy/2h0sakGFOeQV7UHet82hMV43HOoJPZ9ojwEgDyFw8l3vn2rqk8Ne2Svv5lQbOtg4
-        bIS1ZxdvAcgOAtSe83z8lpLoiu3efq6DQI+XbqwHYK1Xuc2dqJnN2dWgmlj/6a6RBYA9JzV3kiAkhwCy
-        mjsRhHA3ew4A6CXXypZ027sOPgLfJxqj4QsnOeYdyIJAXvupjTkKgJwCgb1myMQ4GoAcA0F7pFzZ1fYP
-        Y4waC45g6MYAAAAASUVORK5CYII=
+        iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAL
+        EwAACxMBAJqcGAAAAcVJREFUWEftlWlOwzAQhSvBvXqBxE6AsF6Fnb9IRaq4AQK1qBywRSpv7HGapON4
+        +Uuf9KTW45n5so0nSlXbBD9MAipL/SjkeZ0CcM89gkqBiAJAwTuuHa1YiBiAW66ZrBiIAIBacK1sKaVX
+        cm3rUYCiUL9a6wuulSyl6huqIdV2Dj6CXIiY5mQBQC2GiakQnuYbPI7lYG0PwLxw1CwXwte8KPQpxYcv
+        Zgsw/NTKsjrHOqh3m+EZh73CVc67OYBZo9YJh426EA5AHDK4mgYxA4EreOPloLD/3eaoNR5pzcs9OQja
+        PDpeUeAMe175b7SQM/M1dyII/nnQQQf9Z4WGAWbJJfZ8NE1zxEtBTafTY0zOLxpivCTK9KZx6IPADL/a
+        HSxqQYU55BXtQd63zaExXjcc6gk9n2iPASAPIXDyXe+fauqTw17ZK+/mVBs62DhshLVnF28ByA4C1J7z
+        fPyWkuiK7d5+roNAj5durAdgrVe5zZ2omc3Z1aCaWP/prpEFgD0nNXeSICSHALKaOxGEcDd7DgDoJdfK
+        lnTbuw4+At8nGqPhCyc55h3IgkBe+6mNOQqAnAKBvWbIxDgagBwDQXukXNnV9g9jjBoLjmDoxgAAAABJ
+        RU5ErkJggg==
 </value>
   </data>
   <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />