且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

C#控制台应用程序中的调度程序存在问题

更新时间:2023-11-03 15:10:10

您实际上需要通过调用

You need to actually start the dispatcher by calling Dispatcher.Run() for the dispatcher to process the calls invoked to it.

从控制台应用程序中使用Dispatcher是很奇怪的-Dispatcher用于WPF应用程序,但我想它可以工作.

It's pretty strange to use a Dispatcher from a console application - the Dispatcher is used for WPF applications but I guess it will work.

请注意,对Dispatcher.Run()的调用不会返回-它将进入循环,直到您调用

Note that the call to Dispatcher.Run() won't return - it will enter a loop until you call Dispatcher.BeginInvokeShutdown()

请参见 查看全文