Click here to Skip to main content
15,881,248 members
Articles / Web Development / XHTML
Article

A Simple Smart Solution for Silverlight Versioning Conflicts

Rate me:
Please Sign up or sign in to vote.
1.44/5 (3 votes)
22 Oct 2008CPOL3 min read 28.7K   96   16   4
A solution for Silverlight versioning conflicts
Image 1

Introduction

I used Silverlight technology in my Electronic School web site. With the help of the great MinoPlayer and silver light streaming services, I was able to provide visual lessons to my students. My site was using Silverlight 2 beta 2 for not less than three months, most of my students downloaded that beta version and all things went fine!

Recently, when Microsoft came up with the final version of Silverlight 2, I was facing problems upgrading to that final version. I did not want to interrupt my students upgrading to the latest version and, in the same time, I was afraid if they upgrade to the newer version, for instance when using a website that requires the final version, my web site would no longer provide them with the video lessons!

MinoPlayer’s author has provided a new version of his product that is compatible with the final release of Silverlight 2, but it can not work with Silverlight 2 beta 2. The old version of MinoPlayer can not work with the final release of Silverlight 2!
Also I wanted my new students to be able to download and use the final release of Silverlight.

Using the Code

I was working hard finding a solution that can handle the following scenarios:

  • My existing students should be able to use their current download of Silverlight (Silverlight 2 beta 2); and, in the same time, they should have a chance to upgrade to the final release if they want.
  • If my existing students upgrade to the final release of Silverlight, for instance when using a website that requires a newer version of Silverlight, my application must be able to serve them.
  • My new students should be provided by the final version and my application should not enforce them to use an older version of Silverlight.

After some experimentation, I came up with very simple, and yet efficient, solution of Silverlight versioning conflicts.
In the server side I put the both versions of MinoPlayer. MinoPlayer_Ver1_2.xap (the old version) and I renamed the new version as MinoPlayer_Ver1_2Final.xap and I put them in the same directory. 

The remainder of the magic was implemented in the client side: I provided two nested Silverlight objects. The outer object is pointing to Silverlight 2 final release and the source is pointing to the new version of MinoPlayer:

XML
<object data="data:application/x-silverlight,"
     type="application/x-silverlight-2"
          width="90%" height="330">
<param name="source" value="MinoPlayer_Ver1_2Final.xap">

The download hint for this outer object is pointing to the location of Microsoft’s final release of Silverlight 2:

HTML
<a href="http://go.microsoft.com/fwlink/?LinkId=124807"
     style="text-decoration: none;">
<img src='info.PNG' 
style='width:17px; height:19px;border-style: none' align='middle'>
<span class='lazez'><strong>There is a newer version of  
<span style='color:#FF00FF'>Microsoft Silverlight</span>
...Click here if you want to install it</strong></span>
</a>

The inner object is pointing to Silverlight 2 beta 2 and the source is pointing to the old version of MinoPlayer:

XML
<object data="data:application/x-silverlight," 
type="application/x-silverlight-2-b2"
                      width="90%" height="330">
<param name="source" 
value="MinoPlayer_Ver1_2.xap">

The download hint for the inner object is, also, pointing to the location of Microsoft’s final release of Silverlight 2:

HTML
<a href="http://go.microsoft.com/fwlink/?LinkId=124807" 
    style="text-decoration: none;">
<img src="http://go.microsoft.com/fwlink/?LinkId=108181"
 alt="Click here to install Silverlight"  style="border-style: none">
</a>

Here there is the full HTML code of the idea:

HTML
<div align="center">
<!-- outer silverlight object-->
<object data="data:application/x-silverlight," 
type="application/x-silverlight-2"  
width="90%" height="330">
<param name="source" 
value="MinoPlayer_Ver1_2Final.xap">
<param name="onerror" value="onSilverlightError">
<param name="background" value="black">
<param name="initParams" 
value="VideoSource=http://silverlight.services.live.com/77137/Arabic4/video.wmv
,AutoPlay=false,EnableScrubbing=true,InitialVolume=1
,PreviewImage=http://www.eschoolsudan.com/images/PreviewImage.JPG
,LogoImage=http://www.eschoolsudan.com/images/logosmall.JPG,MarkersTimeView=5">
<div class='worningpanel' align="left">
<a href="http://go.microsoft.com/fwlink/?LinkId=124807" 
style="text-decoration: none;">
<img src='info.PNG' 
style='width:17px; height:19px;border-style: none' align='middle'><
span class='lazez'><strong>There is a newer version of  <
span style='color:#FF00FF'>Microsoft Silverlight</span>
...Click here if you want to install it</strong></span>
</a> ...
</div><br>
<div align="center">
<!-- Inner silverlight object-->
<object data="data:application/x-silverlight," 
type="application/x-silverlight-2-b2" 
 width="90%" height="330">
<param name="source" 
value="MinoPlayer_Ver1_2.xap">
<param name="onerror" value="onSilverlightError">
<param name="background" value="black">
<param name="initParams" 
value="VideoSource=http://silverlight.services.live.com/77137/Arabic4/video.wmv
,AutoPlay=false,EnableScrubbing=true
,InitialVolume=1
,PreviewImage=http://www.eschoolsudan.com/images/PreviewImage.JPG
,LogoImage=http://www.eschoolsudan.com/images/logosmall.JPG,MarkersTimeView=5">
<a href="http://go.microsoft.com/fwlink/?LinkId=124807" 
style="text-decoration: none;">
<img src="http://go.microsoft.com/fwlink/?LinkId=108181" 
alt="Click here to install Silverlight"  style="border-style: none">
</a>
</object>
</div>
</object>
<iframe style='visibility: hidden;
 height: 0; width: 0; border: 0px'></iframe>
</div>

Screen Shots of the Working Application

When the old beta version of Silverlight is installed in the user machine, she will be able to view the lessons while having the chance upgrading to the final release.

When neither of Silverlight versions is installed in the user machine, she will see two links telling her to install Silverlight; pressing either of them she will be able to download the final release.

When the old beta version of Silverlight is installed in the user machine, she will be able to view the lessons while having the chance upgrading to the final release.

When the old beta version of Silverlight is installed in the user machine, she will be able to view the lessons while having the chance upgrading to the final release.

When the old beta version of Silverlight is installed in the user machine, she will be able to view the lessons while having the chance upgrading to the final release.

When the final release of Silverlight is installed in the user machine, she will be provided with the lesson with neither of the links appeared.

Points of Interest

  • In the real implementation of my idea, I provided a PHP function in the server side that constructs the Silverlight objects and populate each of them with its required data; without redundancy of the common data.
  • When testing the application with FireFox, and when the beta version is the working one, the user won't be able to see the download link for the final release. Although this is not very good, it does not harm my idea.
  • My site, and my videos, provides the lessons in Arabic!

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer ,Lecturer,University of Bisha, KSA
Sudan Sudan
Sudanese people is so peaceful, they have been affected greatly from the ban

Comments and Discussions

 
GeneralGood work Pin
Amro Ibrahim26-Oct-08 5:00
Amro Ibrahim26-Oct-08 5:00 
GeneralRe: Good work Pin
Mekki Ahmedi26-Oct-08 5:49
Mekki Ahmedi26-Oct-08 5:49 
GeneralFormatting Pin
Pascal Ganaye23-Oct-08 3:29
Pascal Ganaye23-Oct-08 3:29 
GeneralRe: Formatting Pin
Mekki Ahmedi23-Oct-08 6:59
Mekki Ahmedi23-Oct-08 6:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.