WPF access GUI from other thread

后端 未结 2 765
-上瘾入骨i
-上瘾入骨i 2021-01-22 12:39

I am working through the requirement to make a WPF Application single instance only. However - I have to pass the command line to the first instance and then perform some UI act

2条回答
  •  盖世英雄少女心
    2021-01-22 13:14

    That's not right, are you certain that the mutex is passing control correctly to your currently running instance of the application?

    If it was a thread UI access issue, you should have received this error: The calling thread cannot access this object because a different thread owns it.

    The fact that you're getting an "Object reference not set to an instance of an object." error message means that you've not yet instantiated the object as new.

提交回复
热议问题