Procházet zdrojové kódy

UI fix state in seeking / SL add tooltip(meta) of playlist item

Coder před 8 měsíci
rodič
revize
aae20ee265

+ 9 - 6
Bmp.WinForms/MainForm.cs

@@ -444,6 +444,7 @@ namespace Bmp.WinForms
                     Path = p.Name,
                     Title = p.SubItems[TitleColumnHeader.Index].Text,
                     Duration = p.SubItems[DurColumnHeader.Index].Text,
+                    ToolTip = p.ToolTipText
                 }).ToArray();
             }
 
@@ -685,6 +686,7 @@ namespace Bmp.WinForms
                             item.Name = playlistItem.Path;
                             item.SubItems[TitleColumnHeader.Index].Text = playlistItem.Title;
                             item.SubItems[DurColumnHeader.Index].Text = playlistItem.Duration;
+                            item.ToolTipText = playlistItem.ToolTip;
 
                             MainListView.Items.Add(item);
                         }
@@ -1064,6 +1066,7 @@ namespace Bmp.WinForms
 
         private async void SeekTrackBar_MouseUp(object sender, MouseEventArgs e)
         {
+            MainPanel.Enabled = false;
             if (_inputSource != null)
             {
                 try
@@ -1075,15 +1078,15 @@ namespace Bmp.WinForms
                     var ms = SeekTrackBar.Value;
                     var seekTo = TimeSpan.FromMilliseconds(ms);
 
-                    MainPanel.Enabled = false;
                     await Task.Run(() => _inputSource.CurrentTime = seekTo);
-                    MainPanel.Enabled = true;
 
+                    //read a cluster for detect seek pos
                     _inputSource.ReadBytes(_inputSource.BlockAlign);
-                    if (seekTo - _inputSource.CurrentTime > TimeSpan.FromSeconds(1))
+
+                    //if content not support seek, reload and read&discard until target pos
+                    if (seekTo - _inputSource.CurrentTime > TimeSpan.FromMilliseconds(100))
                     {
-                        //if content not support seek, reload and read&discard until target pos
-                        await ReloadSource(); 
+                        await ReloadSource();
 
                         await Task.Run(() =>
                         {
@@ -1104,7 +1107,7 @@ namespace Bmp.WinForms
                     _playbackState = UIPlaybackState.Error;
                 }
             }
-
+            MainPanel.Enabled = true;
             _trackBarHolding = false;
         }
     }

+ 1 - 0
Bmp.WinForms/SaveLoad/Models/SaveLoadPlaylistItem.cs

@@ -5,5 +5,6 @@
         public string? Path { get; set; }
         public string? Title { get; set; }
         public string? Duration { get; set; }
+        public string? ToolTip { get; set; }
     }
 }