diff --git a/ThriveLauncher/ViewModels/MainWindowViewModel.Playing.cs b/ThriveLauncher/ViewModels/MainWindowViewModel.Playing.cs index bc9328e9..adb21351 100644 --- a/ThriveLauncher/ViewModels/MainWindowViewModel.Playing.cs +++ b/ThriveLauncher/ViewModels/MainWindowViewModel.Playing.cs @@ -765,40 +765,54 @@ private async void DetectPlayingStatusFromBackend() try { - if (thriveRunner.ThriveRunning || thriveRunner.PlayMessages.Count > 0 || - thriveRunner.ThriveOutput.Count > 0) + if (!thriveRunner.ThriveRunning && thriveRunner.PlayMessages.Count <= 0 && + thriveRunner.ThriveOutput.Count <= 0) { - logger.LogInformation("Restoring state from backend for Thrive runner"); + return; + } - CurrentlyPlaying = true; + logger.LogInformation("Restoring state from backend for Thrive runner"); - logger.LogDebug("Restoring play messages from runner"); - PlayMessages.Clear(); - PlayMessages.AddRange(thriveRunner.PlayMessages.Select(FormatPlayMessage)); + CurrentlyPlaying = true; - ThriveOutputFirstPart.Clear(); - ThriveOutputFirstPart.AddRange(thriveRunner.ThriveOutput); + // Restore the playing title to not leave it awkwardly blank + if (thriveRunner.PlayedThriveVersion == null) + { + logger.LogWarning( + "Could not detect played version from Thrive runner, play popup title will be blank"); + } + else + { + PlayingThrivePopupTitle = + string.Format(Resources.PlayingTitle, thriveRunner.PlayedThriveVersion.VersionName); + } - // Output last part has to be updated by the GUI to make sure it is showing the latest data + logger.LogDebug("Restoring play messages from runner"); + PlayMessages.Clear(); + PlayMessages.AddRange(thriveRunner.PlayMessages.Select(FormatPlayMessage)); - RegisterThriveRunnerListeners(); + ThriveOutputFirstPart.Clear(); + ThriveOutputFirstPart.AddRange(thriveRunner.ThriveOutput); - if (!thriveRunner.ThriveRunning) - { - CanCancelPlaying = true; - ThriveIsRunning = false; + // Output last part has to be updated by the GUI to make sure it is showing the latest data - // Make sure this is called, which it isn't necessarily due to the default value of ThriveIsRunning - // variable - OnPlayingEnded(); - } - else - { - ThriveIsRunning = true; - } + RegisterThriveRunnerListeners(); - ThriveOutputIsTruncated = thriveRunner.OutputTruncated; + if (!thriveRunner.ThriveRunning) + { + CanCancelPlaying = true; + ThriveIsRunning = false; + + // Make sure this is called, which it isn't necessarily due to the default value of ThriveIsRunning + // variable + OnPlayingEnded(); } + else + { + ThriveIsRunning = true; + } + + ThriveOutputIsTruncated = thriveRunner.OutputTruncated; } catch (Exception e) {