forked from ClearFoundry/ClearScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDispatcherSyncInvoker.cs
More file actions
39 lines (32 loc) · 922 Bytes
/
DispatcherSyncInvoker.cs
File metadata and controls
39 lines (32 loc) · 922 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
using System;
using System.Windows.Threading;
using Microsoft.ClearScript.Windows.Core;
namespace Microsoft.ClearScript.Windows
{
internal sealed class DispatcherSyncInvoker : ISyncInvoker
{
public DispatcherSyncInvoker()
{
Dispatcher = Dispatcher.CurrentDispatcher;
}
public Dispatcher Dispatcher { get; }
public bool CheckAccess()
{
return Dispatcher.CheckAccess();
}
public void VerifyAccess()
{
Dispatcher.VerifyAccess();
}
public void Invoke(Action action)
{
Dispatcher.Invoke(action, DispatcherPriority.Send);
}
public T Invoke<T>(Func<T> func)
{
return Dispatcher.Invoke(func, DispatcherPriority.Send);
}
}
}