SilverLight自定义加载函数
我正在创建一个 SL4 应用程序,需要通过网络服务查询某些数据才能使用。当浏览器中的 SL 插件下载 xap 文件时,它会显示一个带有蓝色动画圆圈的空白屏幕。当我等待网络服务调用完成时,是否可以挂接到该加载序列并仍然显示此加载屏幕?如果没有,那么显然我需要为我的应用程序创建一个新的起始页面,它的作用相同,而且我觉得这是多余的,因为 SL 已经有了这样的屏幕。
编辑:此应用程序还需要在其生命周期内稍后与网络服务进行通信。我也不想为此创建另一个加载指示器解决方案。因此,我正在寻找最简单的方法来向用户展示我们正在等待应用程序初始化时以及稍后的网络服务。因此,如果有一个很好的加载指示器控件,那么问题是我是否可以将其用作启动屏幕。
I'm creating an SL4 app that needs to query certain data via a webservice in order to be usable at all. While the SL plugin in a browser is downloading the xap file, it shows an empty screen with that blue animated circle. Is it possible to hook into that loading sequence and still show this loading screen while I'm waiting for my webservice calls to finish? If not, then obviously I need to create a new starting page for my app which does the same, and I feel it would be redundant, since SL has such a screen already.
EDIT: This app will also need to communicate with a webservice later during its lifetime. I don't want to create another loading indicator solution for that, too. So I'm looking for the simplest way to show the user that we're waiting for a webserice when the application is initializing and also later. So if there's a nice loading indicator control out there, then the question is if I can use that as a splash screen.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当插件加载 XAP 时会显示初始屏幕,因此此时在 XAP 中运行任何内容都将不起作用。根据您的数据,您可以通过 Javascript 异步加载数据,然后在 XAP 加载后从 Silverlight 访问它来绕过它。
但是,使用“准备应用程序”消息自定义启动屏幕可能更简单,然后实现 BusyIndicator 用于在 Silverlight 中加载数据,在 Web 服务调用开始时显示它,然后挂接到
Completed
事件来隐藏它。这是有关显示自定义启动屏幕 这是指向 Silverlight 工具包,其中包含 BusyIndicator。
The splash screen is displayed while the plugin is loading your XAP, so running anything within your XAP at that point isn't going to work. Depending on your data, you could possibly get around it by loading the data asynchronously via Javascript and then accessing it from Silverlight once your XAP has loaded.
However, it's probably more straightforward to just customise the splash screen with a 'preparing application' message, and then implement a BusyIndicator for loading your data in Silverlight, displaying it at the start of the Web Service call and then hooking into the
Completed
event to hide it.Here's a Channel 9 video on Displaying a Custom Splash Screen and here's a link to the Silverlight Toolkit that includes the BusyIndicator.