|
|
@ -9,28 +9,45 @@ namespace Avalonia.UnitTests |
|
|
/// </summary>
|
|
|
/// </summary>
|
|
|
public class ImmediateDispatcher : IDispatcher |
|
|
public class ImmediateDispatcher : IDispatcher |
|
|
{ |
|
|
{ |
|
|
|
|
|
/// <inheritdoc/>
|
|
|
public bool CheckAccess() |
|
|
public bool CheckAccess() |
|
|
{ |
|
|
{ |
|
|
return true; |
|
|
return true; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
public void Post(Action action, DispatcherPriority priority = DispatcherPriority.Normal) |
|
|
public void Post(Action action, DispatcherPriority priority = DispatcherPriority.Normal) |
|
|
{ |
|
|
{ |
|
|
action(); |
|
|
action(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
public Task InvokeAsync(Action action, DispatcherPriority priority = DispatcherPriority.Normal) |
|
|
public Task InvokeAsync(Action action, DispatcherPriority priority = DispatcherPriority.Normal) |
|
|
{ |
|
|
{ |
|
|
action(); |
|
|
action(); |
|
|
return Task.FromResult<object>(null); |
|
|
return Task.CompletedTask; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
public Task<TResult> InvokeAsync<TResult>(Func<TResult> function, DispatcherPriority priority = DispatcherPriority.Normal) |
|
|
public Task<TResult> InvokeAsync<TResult>(Func<TResult> function, DispatcherPriority priority = DispatcherPriority.Normal) |
|
|
{ |
|
|
{ |
|
|
var result = function(); |
|
|
var result = function(); |
|
|
return Task.FromResult(result); |
|
|
return Task.FromResult(result); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
|
|
public Task InvokeAsync(Func<Task> function, DispatcherPriority priority = DispatcherPriority.Normal) |
|
|
|
|
|
{ |
|
|
|
|
|
return function(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
|
|
public Task<TResult> InvokeAsync<TResult>(Func<Task<TResult>> function, DispatcherPriority priority = DispatcherPriority.Normal) |
|
|
|
|
|
{ |
|
|
|
|
|
return function(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
public void VerifyAccess() |
|
|
public void VerifyAccess() |
|
|
{ |
|
|
{ |
|
|
} |
|
|
} |
|
|
|