Silverlight - 模式对话框

Silverlight - 模式对话框,第1张

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

 一直认为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

总结

以上是内存溢出为你收集整理的Silverlight - 模式对话框全部内容,希望文章能够帮你解决Silverlight - 模式对话框所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1044333.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-24
下一篇 2022-05-24

发表评论

登录后才能评论

评论列表(0条)

保存