mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 13:03:21 +08:00
Disable button while update check is in progress
This commit is contained in:
parent
3dd642a336
commit
4f809767a5
@ -19,6 +19,8 @@ namespace osu.Game.Overlays.Settings.Sections.General
|
|||||||
|
|
||||||
protected override string Header => "Updates";
|
protected override string Header => "Updates";
|
||||||
|
|
||||||
|
private SettingsButton checkForUpdatesButton;
|
||||||
|
|
||||||
[BackgroundDependencyLoader(true)]
|
[BackgroundDependencyLoader(true)]
|
||||||
private void load(Storage storage, OsuConfigManager config, OsuGame game)
|
private void load(Storage storage, OsuConfigManager config, OsuGame game)
|
||||||
{
|
{
|
||||||
@ -29,11 +31,14 @@ namespace osu.Game.Overlays.Settings.Sections.General
|
|||||||
});
|
});
|
||||||
|
|
||||||
// We should only display the button for UpdateManagers that do check for updates
|
// We should only display the button for UpdateManagers that do check for updates
|
||||||
Add(new SettingsButton
|
Add(checkForUpdatesButton = new SettingsButton
|
||||||
{
|
{
|
||||||
Text = "Check for updates",
|
Text = "Check for updates",
|
||||||
Action = () => Schedule(() => Task.Run(updateManager.CheckForUpdateAsync)),
|
Action = () =>
|
||||||
Enabled = { Value = updateManager.CanCheckForUpdate }
|
{
|
||||||
|
checkForUpdatesButton.Enabled.Value = false;
|
||||||
|
Task.Run(updateManager.CheckForUpdateAsync).ContinueWith(t => Schedule(() => checkForUpdatesButton.Enabled.Value = true));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (RuntimeInfo.IsDesktop)
|
if (RuntimeInfo.IsDesktop)
|
||||||
|
Loading…
Reference in New Issue
Block a user