Files
client/Infrastructure/WpfUiDispatcher.cs
2026-05-23 18:16:50 +08:00

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);
}
}