Dreamine.Threading.Wpf 1.0.1
이 패키지는 Worker Thread를 직접 생성하거나 제어하지 않습니다. `IDreamineThreadManager`의 상태만 관찰합니다.
로딩중...
검색중...
일치하는것 없음
WpfThreadUiDispatcher.cs
이 파일의 문서화 페이지로 가기
1using System;
2using System.Windows;
3using System.Windows.Threading;
4
6
16{
25 private readonly Dispatcher _dispatcher;
26
36
46 : this(Application.Current?.Dispatcher ?? Dispatcher.CurrentDispatcher)
47 {
48 }
49
75 {
76 _dispatcher = dispatcher ?? throw new ArgumentNullException(nameof(dispatcher));
77 }
78
103 public void Invoke(Action action)
104 {
105 ArgumentNullException.ThrowIfNull(action);
106
107 if (_dispatcher.CheckAccess())
108 {
109 action();
110 return;
111 }
112
113 _dispatcher.Invoke(action);
114 }
115
140 public void BeginInvoke(Action action)
141 {
142 ArgumentNullException.ThrowIfNull(action);
143
144 if (_dispatcher.CheckAccess())
145 {
146 action();
147 return;
148 }
149
150 _dispatcher.BeginInvoke(action, DispatcherPriority.Background);
151 }
152}