瀏覽代碼

After deleting a song, try to return to the song list near the song
deleted.

Stephen Damm 6 年之前
父節點
當前提交
7193ab63f5
共有 1 個文件被更改,包括 10 次插入1 次删除
  1. 10 1
      SongBrowserPlugin/UI/Browser/SongBrowserUI.cs

+ 10 - 1
SongBrowserPlugin/UI/Browser/SongBrowserUI.cs

@@ -573,7 +573,16 @@ namespace SongBrowserPlugin.UI
                     }
                 }
 
-                _model.LastSelectedLevelId = null;
+                int newRow = _model.SortedSongList.FindIndex(x => x.levelID == level.levelID) - 1;
+                if (newRow > 0 && newRow < _model.SortedSongList.Count)
+                {
+                    _model.LastSelectedLevelId = _model.SortedSongList[newRow].levelID;
+                }
+                else
+                {
+                    _model.LastSelectedLevelId = null;
+                }
+
                 SongLoaderPlugin.SongLoader.Instance.RemoveSongWithPath(songPath);
                 this.UpdateSongList();
                 this.RefreshSongList();