views:

152

answers:

2

We are storing localization strings in database. Localization is needed for multi language application that we are building. Data layer is behind WCF service, and all data is comming throu this WCF channel.

We need to load translations before Slivlerlight application shows up in user browser. So preloading data with this is most logical path to go. But Silverlight asynchronous calls are giving me hard time to load translation strings from database, because result is loaded afer the Silverlight loads.

Is there a way to solve this problem ?

+2  A: 

I see two solutions to the problem:

  1. If you really want to load data even before the Silverlight application shows up in the browser then the only way to do it is passing the data before Silverlight is embeded. In this case you could use AJAX to fetch the data and then dynamically add the SL object to the DOM passing on parameters. This is quite a hassle to do though in my opinion.
  2. How about hiding your application (making the main Grid or container to Visiblilty="Collapsed") until the SL app fetches the data. Set a timer to dynamically check for wether the data has loaded and zoom, there you have it.
Gergely Orosz
Solution 2. sounds interesting I will give it a try, but it is not clean as I hoped for.
zidane
A: 

I`ve found that loading directly from database is not right way to solve localization - translation problem. Translations are something that not change too offten so Im using XML file to store translations. This XML file is embedded resource, and it is generated from database every time when new translations are added.

This way I have no longer troubles loading data width asynchronous calls.

Thanks for the answer...

zidane