How to read a file from Silverlight embedded in Lync?

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?

Answers


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.


Need Your Help

ORM for Lift: Mapper or JPA?

scala jpa lift

I'm creating a small application for my company in Lift. I'm quite a newbie in Scala/Lift so I'm using this chance to practice. Now, I have a question on what ORM system to use.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.