public static async Task BlockAppFromRunning(this IAppConfigurationService configurationService, string title, string body, Func<Task> retryAction = null) { await SemaphoreSlim.WaitAsync(); try { await configurationService.UserDialogService.AlertAsync(body, title); await Task.Delay(1000); retryAction?.Invoke(); } catch (Exception) { // ignored } finally { SemaphoreSlim.Release(); } } }