namespace UCVL.VPNPlus; // The confirmation dialog runs a nested message loop. Shutdown may win while // it is open, or while the package is downloading; never launch afterwards. internal static class ClientUpdateFlow { internal static async Task RunAsync(Func isCurrent, Func confirm, Func> download, Action launch) { if (!isCurrent() || !confirm() || !isCurrent()) return false; var installer = await download(); if (!isCurrent()) return false; launch(installer); return true; } }