开发者

SilverLight custom loading function

开发者 https://www.devze.com 2023-02-21 16:57 出处:网络
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 开发者_开发技巧

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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号