有什么办法可以获取UI线程的Dispatcher当你没有引用任何 UI 元素时?
Dispatcher
您可以从静态应用程序实例中获取 UI Dispatcher:Application.Current.Dispatcher
Application.Current.Dispatcher
您可能想检查Application.Current首先为 null,因为它可以在关闭序列期间被清除。
Application.Current