Silverlight - 模式对话框

 一直认为Telerik Silverlight RadWindow控件的ShowDialog()方法会显示一个模式对话框(modal dialog) - 就像System.Windows.MessageBox.Show方法一样。但是,那不是一个真正的模式对话框:ShowDialog()方法不是同步等待窗口关闭后再返回,而是异步的,即执行后马上返回,继续执行后续代码。

 

来自Telerik 论坛的回复:

 

This is a limitation of Silverlight, since there is no way you can stop the execution thread and get synchronous results. This is one of the reason our RadWindow doesn't work synchronously

 

(http://www.telerik.com/community/forums/silverlight/window/problem-with-threads-how-radwindow-show-works.aspx)

 

 

真正的模式对话框还是那个System.Windows.MessageBox.Show 可是界面不敢恭维。该方法调用了Silverlight的Core代码:

 

[DllImport("agcore", EntryPoint="MessageBox_ShowCore", CharSet=CharSet.Unicode)]
private static extern uint MessageBox_ShowCoreNative(IntPtr context, [MarshalAs(UnmanagedType.LPWStr)] string messageBoxText, [MarshalAs(UnmanagedType.LPWStr)] string caption, uint type, out int result);

 

然后Core又调用了OS的平台方法?因为msdn中有如下描述:

 

The message box may have a slightly different appearance on different platforms. For example, the message box includes an icon when it is displayed on a Macintosh.

 

http://msdn.microsoft.com/en-us/library/system.windows.messagebox(VS.95).aspx

 

似乎这个还有一个问题:有人发现这个会阻断WCF的调用BackgroundWorker上的线程

http://stackoverflow.com/questions/636630/silverlight-messagebox-show-blocking-wcf-service-call-in-backgroundworker

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值