2021-12-17 23:18:20 +03:00
|
|
|
|
namespace NAPS2.Threading;
|
2021-12-17 22:59:54 +03:00
|
|
|
|
|
2022-06-27 04:42:59 +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
|
2018-09-20 01:44:57 +03:00
|
|
|
|
{
|
2021-12-17 22:59:54 +03:00
|
|
|
|
private static IInvoker _current = new DefaultInvoker();
|
|
|
|
|
|
2018-09-20 01:44:57 +03:00
|
|
|
|
/// <summary>
|
2021-12-17 22:59:54 +03:00
|
|
|
|
/// Gets or sets the current implementation of synchronized access to the UI thread.
|
2018-09-20 01:44:57 +03:00
|
|
|
|
/// </summary>
|
2021-12-17 22:59:54 +03:00
|
|
|
|
public static IInvoker Current
|
2018-09-20 01:44:57 +03:00
|
|
|
|
{
|
2021-12-17 22:59:54 +03:00
|
|
|
|
get => _current;
|
|
|
|
|
set => _current = value ?? throw new ArgumentNullException(nameof(value));
|
2018-09-20 01:44:57 +03:00
|
|
|
|
}
|
2021-12-17 22:59:54 +03:00
|
|
|
|
}
|