Migrating DAISY DTB Playback in DaisyNow.Net to Microsoft Silverlight 2.0

Migrating DTB Playback in DaisyNow.Net to Microsoft Silverlight 2.0

 

In the past weekend, I dedicated my time to migrate the expired DTB playback engine that has been used in www.daisynow.net from Microsoft Silverlight 1.1 to “Silverlight 2.0”.

There are a lot of changes in this version. Not only I have to migrate to Silverlight 2.0, But I have also have to upgrade its platform to .NET framework version 3.5. In .Net 3.5 the string comparison function has been slightly changed in the comparisonType parameter, so I have to replace all in my 100+page of code.

Let’s talk about Silverlight migration of DTB Playback that has not yet completed: First, I don’t need to declare the object that I created in the XAML file to use in C# code file (.cs file). It will be automatically done by “InitializeComponent function” and “the .g file”

Please note that: the error that occurred in “InitializeComponent function” will not be told exactly what it is. You have to locate the line and Position by yourselves in your XAML file. The error will be something like this:

 

AG_E_PARSER_BAD_PROPERTY_VALUE [Line: 4 Position: 37]

 

The Second changed I founded is that the GetResponse function is missing!

 

HttpWebRequest request = new BrowserHttpWebRequest(new Uri(strXmlFilePath));

// Get the response by calling GetResponse function.

HttpWebResponse response = request.GetResponse();

// Get the stream containing content returned by the server.

Stream content = response.GetResponseStream();   

So you I have to create a callback function for getting a respond with IAsyncResult like this

 

{

WebRequest request = (WebRequest)WebRequest.Create(new Uri(strXmlFilePath));

// Get the response by the callback function.

request.BeginGetResponse(new AsyncCallback(MyCallback), request);

}

 

private void MyCallback(IAsyncResult asyncResult) {WebRequest request = (WebRequest)asyncResult.AsyncState;

WebResponse response = (WebResponse)request.EndGetResponse(asyncResult);

// Get the stream containing content returned by the server.

Stream respStream = response.GetResponseStream();

}

 

Last but not least, it is the change about XmlReaderSettings from Boolean to Enumerator! That is  settings.ProhibitDtd = false; => this option is not Boolean anymore; It has been change to enumerator!

Anyway, see you next week with the progress on updating DAISY Digital Talking Book Playback Upgrading from Silverlight 1.1 to Silverlight 2.0

Cheers,

Tanakom.

Leave a Reply