更新时间:2023-02-20 16:38:49
MessageBox.Show
阻止当前线程,直到用户关闭该消息。工作线程在被阻止时无法处理取消请求。
从工作线程显示模态消息也可能不是一个好主意。它可能会产生意想不到的后果:
MessageBoxes和工作线程 [ ^ ]
你在做什么似乎是一个非常糟糕的主意。您真的希望用户必须单击确定1000次吗?
MessageBox.Show
blocks the current thread until the message is closed by the user. The worker thread cannot process the cancellation request whilst it is blocked.
It's also probably not a good idea to show a modal message from a worker thread. It could have unintended consequences:
MessageBoxes and worker threads[^]
What you're doing seems like a very bad idea. Do you really want your users to have to click "OK" 1000 times?