0
我的应用程序工作正常,但现在我想有自定义开机,这样我就可以捕捉任何错误,从一开始就加我的日志等如何在使用自定义启动时“恢复”SynchronizationContext?
所以我使用的方法如本答案What code controls the startup of a WPF application?
[STAThread]
public static void Main(string[] args) {
//include custom startup code here
var app = new MyApplication();//Application or a subclass thereof
var win = new MyWindow();//Window or a subclass thereof
app.Run(win); //do WPF init and start windows message pump.
}
它工作正常,但有一个例外 - SynchronizationContext.Current
为空。我需要它:-)
那么如何正确地进行自定义启动并拥有同步上下文?
太好了,我有我想要的所有功能,非常感谢! – astrowalker