naps2/NAPS2.Sdk/Threading/Invoker.cs

19 lines
524 B
C#
Raw Normal View History

namespace NAPS2.Threading;
2021-12-17 22:59:54 +03:00
// TODO: Can we get rid of this static context?
2021-12-17 22:59:54 +03:00
/// <summary>
/// Synchronized access to the UI thread.
/// </summary>
public static class Invoker
{
2021-12-17 22:59:54 +03:00
private static IInvoker _current = new DefaultInvoker();
/// <summary>
2021-12-17 22:59:54 +03:00
/// Gets or sets the current implementation of synchronized access to the UI thread.
/// </summary>
2021-12-17 22:59:54 +03:00
public static IInvoker Current
{
2021-12-17 22:59:54 +03:00
get => _current;
set => _current = value ?? throw new ArgumentNullException(nameof(value));
}
2021-12-17 22:59:54 +03:00
}