我将使用InvokeRequired
到C#WPF为什么InvokeRequired和Dispatcher.CheckAccess的布尔值颠倒了?
// VB
If Me.InvokeRequired Then
MessageBox.Show("Apple")
Else
MessageBox.Show("Orange")
End If
的VB代码返回一个VB窗体代码 “苹果”
// C#
if (this.Dispatcher.CheckAccess())
{
MessageBox.Show("Apple");
}
else
{
MessageBox.Show("Orange");
}
但我的C#代码返回 “橙”
是不是C#的CheckAccess
与VB Formc的InvokeRequired
相同?为什么布尔值被倒置?
的WPF家伙没聊到的WinForms家伙需要。 – 2012-03-16 12:38:55