private static async Task <T> ShowAsync <T>(Func <Task <T> > show, IDispatcherEx dispatcher) { await _showAsyncSemaphoreSlim.WaitAsync(); try { dispatcher = dispatcher ?? WindowEx.Current().Dispatcher ?? throw new ArgumentNullException(nameof(dispatcher)); return(await dispatcher.DispatchAsync(async() => await show())); } finally { _showAsyncSemaphoreSlim.Release(); } }