diff --git a/osu.Desktop/Overlays/VersionManager.cs b/osu.Desktop/Overlays/VersionManager.cs index 70925f6cf4..9532652bfe 100644 --- a/osu.Desktop/Overlays/VersionManager.cs +++ b/osu.Desktop/Overlays/VersionManager.cs @@ -189,19 +189,24 @@ namespace osu.Desktop.Overlays private class UpdateProgressNotification : ProgressNotification { + private OsuGame game; + protected override Notification CreateCompletionNotification() => new ProgressCompletionNotification() { Text = @"Update ready to install. Click to restart!", Activated = () => { - UpdateManager.RestartApp(); + UpdateManager.RestartAppWhenExited(); + game.GracefullyExit(); return true; } }; [BackgroundDependencyLoader] - private void load(OsuColour colours) + private void load(OsuColour colours, OsuGame game) { + this.game = game; + IconContent.Add(new Drawable[] { new Box diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 7172aba3be..ccea6ef458 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -307,6 +307,18 @@ namespace osu.Game return base.OnExiting(); } + /// + /// Use to programatically exit the game as if the user was triggering via alt-f4. + /// Will keep persisting until an exit occurs (exit may be blocked multiple times). + /// + public void GracefullyExit() + { + if (!OnExiting()) + Exit(); + else + Scheduler.AddDelayed(GracefullyExit, 2000); + } + protected override void UpdateAfterChildren() { base.UpdateAfterChildren();