diff --git a/PlaylistManager/UI/RefreshButtonUI.cs b/PlaylistManager/UI/RefreshButtonUI.cs index 6b55e58..b940d7d 100644 --- a/PlaylistManager/UI/RefreshButtonUI.cs +++ b/PlaylistManager/UI/RefreshButtonUI.cs @@ -3,16 +3,20 @@ using SongCore; using SongCore.UI; using System; -using System.Threading.Tasks; using Zenject; namespace PlaylistManager.UI { public class RefreshButtonUI : IInitializable, IDisposable { + private readonly ProgressBar _progressBar; + private MenuButton refreshButton; - private ProgressBar progressBar; - private const int kMessageTime = 5; + + private RefreshButtonUI(ProgressBar progressBar) + { + _progressBar = progressBar; + } public void Initialize() { @@ -30,14 +34,7 @@ private async void SongsLoaded(Loader _, System.Collections.Concurrent.Concurren PlaylistLibUtils.playlistManager.RefreshPlaylists(true); var numPlaylists = PlaylistLibUtils.playlistManager.GetPlaylistCount(true); - - // This event handler is loading sprites and accessing Unity objects so it must be done on the main thread. - // Although SongsLoadedEvent is already invoked on the main thread, the default event handler in ProgressBar - // will overwrite our message. We're essentially skipping a frame to let the default event handler run first. - await Task.Yield(); - - progressBar.enabled = true; - progressBar.ShowMessage($"\n{numPlaylists} playlists loaded.", kMessageTime, false); + _progressBar.AppendText($"\n{numPlaylists} playlists loaded"); } public void Dispose() diff --git a/PlaylistManager/manifest.json b/PlaylistManager/manifest.json index 60769e4..04c8b2f 100644 --- a/PlaylistManager/manifest.json +++ b/PlaylistManager/manifest.json @@ -12,10 +12,10 @@ "icon": "PlaylistManager.Icons.Logo.png", "dependsOn": { "BSIPA": "^4.3.0", - "SongCore": "^3.9.5", + "SongCore": "^3.14.5", "BeatSaberMarkupLanguage": "^1.7.5", "SiraUtil": "^3.0.0", - "BeatSaberPlaylistsLib": "^1.6.8", + "BeatSaberPlaylistsLib": "^1.7.0", "BeatSaverSharp": "^3.4.5", "System.IO.Compression": "^4.6.57", "System.IO.Compression.FileSystem": "^4.7.3056"