18 lines
433 B
C#
18 lines
433 B
C#
namespace CloudPrint.Client.Infrastructure;
|
|
|
|
public sealed class WpfUiDispatcher : IUiDispatcher
|
|
{
|
|
public void Invoke(Action action)
|
|
{
|
|
ArgumentNullException.ThrowIfNull(action);
|
|
|
|
var dispatcher = System.Windows.Application.Current?.Dispatcher;
|
|
if (dispatcher is null || dispatcher.CheckAccess())
|
|
{
|
|
action();
|
|
return;
|
|
}
|
|
|
|
dispatcher.Invoke(action);
|
|
}
|
|
} |