V 1.0 Downloader Breaking Change

Due to difficulties in providing reliable synchronous downloads cross-platform, we’ve removed this from our downloader API. Removing this means we no longer need the 3rd parameter on the downloader open call so this has been removed. Since we’ve removed an argument, you have to do a bit more work to create content that works with both the Mix bits and the upcoming V1.0 bits. The first thing you’ll need is a way to check the Silverlight version and you can do this using the version string on the host content property. I’ve writing a version check that I put in my silverlight.js file:

 

// Check the minor version number

Sys.Silverlight.checkVersion = function(host, version) {

  var ver = host.settings.version;

  var check = null;

  if (ver) {

    if (ver.split(".")[2] == version) {

      check = true;

    } else {

      check = false;

    }

  }

 

  return check;

}

 

For Mix, the version is 0.09.20416 and you can use the minor version to differentiate between the Mix version and the V1.0 version. You can check for the Mix version using the above function as follows:

 

if (Sys.Silverlight.checkVersion(sender, "20416")) {

  _mix = true;

}

 

Once you have that, you can then write code that adds the extra argument to the downloader open method only when using Mix bits:

 

function download(host, file) {

  var dl = host.createObject("downloader");

  dl.addEventListener("completed", downloadComplete);

 

  // If Mix version, add the extra argument

  if (_mix) {

    dl.open("get", file, true);

  } else {

    dl.open("get", file);

  }

  dl.send();

}

 

I’ve made this change to both VideoSearch and CreateFromXAML.