public static async Task LockExtAsync(this XtraForm xtraForm, Func<Task> onLock) { IOverlaySplashScreenHandle handle = null; try { handle = SplashScreenManager.ShowOverlayForm(xtraForm); await onLock(); } finally { SplashScreenManager.CloseOverlayForm(handle); } } // USAGE await form.LockExtAsync(async () => { // Login here });