Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public sealed class WpfContext
- : IContext
- {
- private readonly Dispatcher _dispatcher;
- public bool IsSynchronized
- {
- get
- {
- return this._dispatcher.Thread == Thread.CurrentThread;
- }
- }
- public WpfContext()
- : this(Dispatcher.CurrentDispatcher)
- {
- }
- public WpfContext(Dispatcher dispatcher)
- {
- Debug.Assert(dispatcher != null);
- this._dispatcher = dispatcher;
- }
- public void Invoke(Action action)
- {
- Debug.Assert(action != null);
- this._dispatcher.Invoke(action);
- }
- public void BeginInvoke(Action action)
- {
- Debug.Assert(action != null);
- this._dispatcher.BeginInvoke(action);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement