Question

I'm trying to read a XML file from Silverlight. I do it perfectly and I read it from xap as a desktop application (running on VS 2010).

But when I load the silverlight from CWE (Conversation Window Extension) from Lync 2010, it returns an unhandled error.

As application, i do this: Add as reference the xml file to the solution I download the xml as an uri When download is complete, i read the file.

Any help or tip will be preciated.

The code that im using is this:

        private void button1_Click_1(object sender, RoutedEventArgs e)
    {
        //this.MessageLabel_SET("Loading Languages...");

        WebClient xmlClient = new WebClient();
        xmlClient.DownloadStringCompleted += new DownloadStringCompletedEventHandler(XMLFileLoaded);
        xmlClient.DownloadStringAsync(new Uri(textBox1.Text, UriKind.RelativeOrAbsolute));
    }

 void XMLFileLoaded(object sender, DownloadStringCompletedEventArgs e)
    {
        string XmlString = e.Result; // Got all your XML data in to a string 
        Main_Language.Read_XML(XmlString);
        Main_Language.Load_Index_From_XML();
        LanguageSelector.ItemsSource = Main_Language.Language_Indexes;
        LanguageSelector.IsEnabled = true;
        sendData.IsEnabled = true;
        //MessageLabel_SET("Language Loaded");
    }

So, how can i read an external file from a CWE Lync 2010 app in Silverlight 4?

Was it helpful?

Solution

This can be done by using Isolated Storage File. You read the XML, then copy the content, not the file, to isolated storage file, and so on. You can do the same for 'download', you must create the file after read the isolated storage file.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top