Update mod list through Wait.StartWaiting #3637
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Background
Both refreshing the registry and updating the mod list use the
Wait
tab to log their progress, so the user can see what is happening and can tell the app hasn't frozen (see #2617).Problems
Recently (dev builds only), if you refresh the registry in GUI, the log messages for repo update remain visible while the mod list is being refreshed. The progress tab should reset because they're separate processes.
Similarly (also dev builds only), if you use the download to cache option for a mod, we open the progress tab for the download and then refresh the mod list, which also uses the progress tab, but we jump back to the mod list in between.
Cause
In #3635 we refactored the
Wait
tab to clean up error handling and make its use more consistent. All of the manyBackgroundWorkers
were combined into one and encapsulated insideWait
. As part of this,Wait.ClearLog
was madeprivate
and moved from the many places where it was called previously toWait.StartWaiting
as a way to guarantee proper state when the tab starts up.This missed the mod list refresh because it was not using a
BackgroundWorker
, but rather started a background thread withawait Task.Factory.StartNew
. So whileWait.ClearLog()
was removed from the end of repo update, it was not added to the start of mod list updating.#3635 added a call to refresh the mod list after a download to cache but didn't remove the logic that closed it when done.
Changes
Wait.StartWaiting
, like all the other users of the progress tab. The logic for refreshing the list is still inManageMods
, but the parts that manipulate the overall window state are moved toMain.ManageMods_OnRefresh
.This way, when you update the registry, the
Wait
tab remains active (we do not want it to flicker-jump back to and from the mod list tab) but clears itself between the two flows.