Sfoglia il codice sorgente

fix index for first item

Coder 7 mesi fa
parent
commit
523c778006
1 ha cambiato i file con 12 aggiunte e 6 eliminazioni
  1. 12 6
      Bmp.WinForms/MainForm.cs

+ 12 - 6
Bmp.WinForms/MainForm.cs

@@ -80,7 +80,7 @@ namespace Bmp.WinForms
             _currentListViewItem = item;
             _currentListViewItem.EnsureVisible();
             _currentListViewItem.SubItems[StateColumnHeader.Index].Text = EMOJI_LOADING;
-            
+
             var finalState = EMOJI_PLAY_BIG;
 
             var balloonShow = false;
@@ -411,7 +411,7 @@ namespace Bmp.WinForms
                 if (itemsCount > 2 && playlistMode == PlaylistMode.Random)
                     nextIndex = Rng.Next(itemsCount);
                 else
-                    nextIndex = 1;
+                    nextIndex = 0;
             }
             else
             {
@@ -481,7 +481,7 @@ namespace Bmp.WinForms
                 if (itemsCount > 2 && playlistMode == PlaylistMode.Random)
                     nextIndex = Rng.Next(itemsCount);
                 else
-                    nextIndex = 1;
+                    nextIndex = 0;
             }
             else
             {
@@ -782,9 +782,15 @@ namespace Bmp.WinForms
 
             var type = value.GetType();
             var name = Enum.GetName(type, value);
-            var d = type.GetField(name)?.GetCustomAttribute<DisplayAttribute>();
-
-            PlaylistModeButton.Text = d?.ShortName;
+            if (name != null)
+            {
+                var d = type.GetField(name)?.GetCustomAttribute<DisplayAttribute>();
+                PlaylistModeButton.Text = d?.ShortName;
+            }
+            else
+            {
+                PlaylistModeButton.Text = "?";
+            }
         }
 
         // -----------------  UI event: Form -----------------