public PackageDownloadManager(ISilverlightLoader loader, IDictionary <string, string> initParams, float maxTransferRateKB)
        {
            // parse the package source list from init params
            List <Uri> packageFileList = ParamUtil.initParamsToUriList(initParams);

            ParamUtil.fixRelativeLinks(ref packageFileList);
            init(loader, packageFileList, maxTransferRateKB);
        }
 /// <summary>
 /// download a package
 /// </summary>
 /// <param name="packageSource"></param>
 /// <param name="progressCallback"></param>
 public void download(Uri packageSource, ISilverlightLoader progressCallback)
 {
     abort();
     m_progressCallbackInterface = progressCallback;
     m_packageSource             = packageSource;
     m_progressCallbackInterface.downloadStartCallback(packageSource);
     m_webClient = new WebClient();
     m_webClient.DownloadProgressChanged += onDownloadProgressChanged;
     m_webClient.OpenReadCompleted       += onOpenReadCompleted;
     m_webClient.OpenReadAsync(packageSource);
 }
 public void download(Uri packageSource, ISilverlightLoader progressCallback, float maxTransferRateKB)
 {
     abort();
     m_progressCallbackInterface = progressCallback;
     m_packageSource             = packageSource;
     m_progressCallbackInterface.downloadStartCallback(packageSource);
     m_webClient = new WebClient();
     m_webClient.DownloadProgressChanged += onDownloadProgressChanged;
     m_webClient.OpenReadCompleted       += onOpenReadCompleted;
     m_webClient.OpenReadAsync(packageSource);
     // sim misc
     initTimer();
     m_maxTransferRateKBS = maxTransferRateKB;
 }
 private void init(ISilverlightLoader loader, List <Uri> packageSourceList, float maxTransferRateKB)
 {
     // save transfer rate if any
     m_maxTransferRateKB = maxTransferRateKB;
     // save loader callback interface
     m_loader = loader;
     // call init callback with package list
     m_loader.initCallback(packageSourceList);
     // iterate through list and start downloading the files
     foreach (Uri packageSourceFile in packageSourceList)
     {
         if (!isStreamingUri(packageSourceFile))
         {
             if (maxTransferRateKB > 0)
             {
                 simulateFileDownload(packageSourceFile);
             }
             else
             {
                 downloadFile(packageSourceFile);
             }
         }
         else
         {
             SilverlightStreamingUtil.GetMediaStreamUriCallback gmsCallback;
             // check if sim mode is on
             if (maxTransferRateKB > 0)
             {
                 gmsCallback = new SilverlightStreamingUtil.GetMediaStreamUriCallback(simulateFileDownload);
             }
             else
             {
                 gmsCallback = new SilverlightStreamingUtil.GetMediaStreamUriCallback(downloadFile);
             }
             // start the streaming media url process
             SilverlightStreamingUtil streamUtil = new SilverlightStreamingUtil(gmsCallback);
             streamUtil.getMediaStreamUri(packageSourceFile.ToString());
         }
     }
 }
 public PackageDownloadManager(ISilverlightLoader loader, List <Uri> packageSourceList, float maxTransferRateKB)
 {
     init(loader, packageSourceList, maxTransferRateKB);
 }
 private void init(ISilverlightLoader loader, List<Uri> packageSourceList, float maxTransferRateKB)
 {
     // save transfer rate if any
     m_maxTransferRateKB = maxTransferRateKB;
     // save loader callback interface
     m_loader = loader;
     // call init callback with package list
     m_loader.initCallback(packageSourceList);
     // iterate through list and start downloading the files
     foreach (Uri packageSourceFile in packageSourceList)
     {
         if (!isStreamingUri(packageSourceFile))
         {
             if (maxTransferRateKB > 0)
                 simulateFileDownload(packageSourceFile);
             else
                 downloadFile(packageSourceFile);
         }
         else
         {
             SilverlightStreamingUtil.GetMediaStreamUriCallback gmsCallback;
             // check if sim mode is on
             if (maxTransferRateKB > 0)
                 gmsCallback = new SilverlightStreamingUtil.GetMediaStreamUriCallback(simulateFileDownload);
             else
                 gmsCallback = new SilverlightStreamingUtil.GetMediaStreamUriCallback(downloadFile);
             // start the streaming media url process
             SilverlightStreamingUtil streamUtil = new SilverlightStreamingUtil(gmsCallback);
             streamUtil.getMediaStreamUri(packageSourceFile.ToString());
         }
     }
 }
 public PackageDownloadManager(ISilverlightLoader loader, List<Uri> packageSourceList, float maxTransferRateKB)
 {
     init(loader, packageSourceList, maxTransferRateKB);
 }
 public PackageDownloadManager(ISilverlightLoader loader, IDictionary<string, string> initParams, float maxTransferRateKB)
 {
     // parse the package source list from init params
     List<Uri> packageFileList = ParamUtil.initParamsToUriList(initParams);
     ParamUtil.fixRelativeLinks(ref packageFileList);
     init(loader, packageFileList, maxTransferRateKB);
 }
 public void download(Uri packageSource, ISilverlightLoader progressCallback, float maxTransferRateKB)
 {
     abort();
     m_progressCallbackInterface = progressCallback;
     m_packageSource = packageSource;
     m_progressCallbackInterface.downloadStartCallback(packageSource);
     m_webClient = new WebClient();
     m_webClient.DownloadProgressChanged += onDownloadProgressChanged;
     m_webClient.OpenReadCompleted += onOpenReadCompleted;
     m_webClient.OpenReadAsync(packageSource);
     // sim misc
     initTimer();
     m_maxTransferRateKBS = maxTransferRateKB;
 }
 /// <summary>
 /// download a package
 /// </summary>
 /// <param name="packageSource"></param>
 /// <param name="progressCallback"></param>
 public void download(Uri packageSource, ISilverlightLoader progressCallback)
 {
     abort();
     m_progressCallbackInterface = progressCallback;
     m_packageSource = packageSource;
     m_progressCallbackInterface.downloadStartCallback(packageSource);
     m_webClient = new WebClient();
     m_webClient.DownloadProgressChanged += onDownloadProgressChanged;
     m_webClient.OpenReadCompleted += onOpenReadCompleted;
     m_webClient.OpenReadAsync(packageSource);
 }