Dear Telerik or anyone knowledgeable,
I am presently building my first real life application using RadControls for SL. So far I pretty much like it and controls from Telerik are really powerful. This particular application is essentially a video player built around RadMediaPlayer.
I have two external XML files. First one contains configuration information like width and height of video player. Here is how it looks like in present form.
<?xml version="1.0" encoding="utf-8" ?>
<video_player_config>
<video_contentdescription_file>http://localhost:83/JSVP_Video_player/Playlist.media.xml</video_contentdescription_file>
<videoplayer_width>300</videoplayer_width>
<videoplayer_height>300</videoplayer_height>
</video_player_config>
The second one contains data for media items in the following structure:
<mediaItems>
<mediaItem>
<title></title>
<description> </description>
<mediaUrl> </mediaUrl>
<imageUrl> </imageUrl>
etc.
Now I have written a static class named “SichulaVideoPlayerConfig” that opens XML configuration file using WebClient and then parses it using LINQ to XML. This works fine on its own. The trouble is that when I call SichulaVideoPlayerConfig.LoadConfigFile during Application_Startup in app.xaml.cs, the data from XML configuration file are not yet there and the player UI initializes as empty.
It seems to me that the problem is related to the asynchronous nature of WebClient.OpenReadAsync method. I understand that it runs on different thread than UI. Because of that my UI initializes and yet data from XML file are still not available.
I kindly ask for help in how to overcome this unwanted situation. A working code example would be most welcome and I have already read much theory but to no avail.
Kindly please, please, help me.
Jan Sichula
(Slovak Republic)
http://sichula.temelios.sk/ (English website for friends – family photos, videos and newsletter archive)