Esempio n. 1
0
 public DownloadItem(Uri argUri, string argFullPath, bool argIsThread, WatchThread argWatcher, string argUserName, string argPassword)
 {
     try {
         this.itemUri           = argUri;
         this.fullPath          = argFullPath;
         this.retries           = 0;
         this.isThread          = argIsThread;
         this.watchThread       = argWatcher;
         this.completed         = false;
         this.started           = false;
         this.isInDownloadQueue = false;
         this.username          = argUserName;
         this.password          = argPassword;
         this.dltViewItem       = new DownloaderTaskViewItem();
     } catch (Exception exception) {
         MessageBox.Show("Erorr in DownloadItem constructor, throwing.\r\n" + exception.Message);
     }
 }
Esempio n. 2
0
 public DownloadItem(Uri argUri, string argFullPath, bool argIsThread, WatchThread argWatcher, string argUserName, string argPassword)
 {
     try {
     this.itemUri = argUri;
     this.fullPath = argFullPath;
     this.retries = 0;
     this.isThread = argIsThread;
     this.watchThread = argWatcher;
     this.completed = false;
     this.started = false;
     this.isInDownloadQueue = false;
     this.username = argUserName;
     this.password = argPassword;
     this.dltViewItem = new DownloaderTaskViewItem();
       } catch (Exception exception) {
     MessageBox.Show("Erorr in DownloadItem constructor, throwing.\r\n" + exception.Message);
       }
 }
Esempio n. 3
0
 public void StartDownload()
 {
     try {
         this.uriData  = this.downloadItem.itemUri;
         this.fileName = this.downloadItem.fullPath;
         this.downloadItem.downloaderTask = this;
         this.webClient      = new WebClient();
         this.lastUpdateTime = DateTime.Now;
         this.errTimedOut    = false;
         this.webClient.DownloadProgressChanged += new DownloadProgressChangedEventHandler(this.webClient_DownloadProgressChanged);
         this.webClient.DownloadFileCompleted   += new AsyncCompletedEventHandler(this.webClient_DownloadFileCompleted);
         this.webClient.Headers.Add("user-agent", "Opera/9.99 (Windows NT 5.1; U; pl) Presto/9.9.9");
         this.webClient.Credentials     = new NetworkCredential(this.downloadItem.username, this.downloadItem.password);
         this.bytesDownloadedTotal      = 0L;
         this.bytesDownloadedLast       = 0L;
         this.lastUpdateTime            = DateTime.Now;
         this.timeoutNoResponse         = Settings.Default.TimeoutNoResponse;
         this.downloaderTicker          = new System.Timers.Timer();
         this.downloaderTicker.Elapsed += new ElapsedEventHandler(this.downloaderTickerUpdate);
         this.downloaderTicker.Interval = 10000.0;
         this.downloaderTicker.Start();
         DownloaderTaskViewItem item2 = new DownloaderTaskViewItem
         {
             URL = this.uriData.ToString(),
             PercentDownloaded = "0",
             BytesDownloaded   = "0",
             BytesTotal        = "",
             Retries           = this.downloadItem.retries.ToString()
         };
         DownloaderTaskViewItem item = item2;
         item.downloaderTask = this;
         this.downloadManager.dltaskViewCollection.Add(item);
         this.downloaderTaskViewItem = item;
         this.LetsDoThisThing();
     } catch (Exception exception) {
         throw exception;
     }
 }
 public void AddItem(DownloaderTaskViewItem argdltvi)
 {
     this.thedltvitems.Add(argdltvi);
     base.OnPropertyChanged("TheListItems");
 }
Esempio n. 5
0
 public void StartDownload()
 {
     try {
     this.uriData = this.downloadItem.itemUri;
     this.fileName = this.downloadItem.fullPath;
     this.downloadItem.downloaderTask = this;
     this.webClient = new WebClient();
     this.lastUpdateTime = DateTime.Now;
     this.errTimedOut = false;
     this.webClient.DownloadProgressChanged += new DownloadProgressChangedEventHandler(this.webClient_DownloadProgressChanged);
     this.webClient.DownloadFileCompleted += new AsyncCompletedEventHandler(this.webClient_DownloadFileCompleted);
     this.webClient.Headers.Add("user-agent", "Opera/9.99 (Windows NT 5.1; U; pl) Presto/9.9.9");
     this.webClient.Credentials = new NetworkCredential(this.downloadItem.username, this.downloadItem.password);
     this.bytesDownloadedTotal = 0L;
     this.bytesDownloadedLast = 0L;
     this.lastUpdateTime = DateTime.Now;
     this.timeoutNoResponse = Settings.Default.TimeoutNoResponse;
     this.downloaderTicker = new System.Timers.Timer();
     this.downloaderTicker.Elapsed += new ElapsedEventHandler(this.downloaderTickerUpdate);
     this.downloaderTicker.Interval = 10000.0;
     this.downloaderTicker.Start();
     DownloaderTaskViewItem item2 = new DownloaderTaskViewItem
     {
       URL = this.uriData.ToString(),
       PercentDownloaded = "0",
       BytesDownloaded = "0",
       BytesTotal = "",
       Retries = this.downloadItem.retries.ToString()
     };
     DownloaderTaskViewItem item = item2;
     item.downloaderTask = this;
     this.downloadManager.dltaskViewCollection.Add(item);
     this.downloaderTaskViewItem = item;
     this.LetsDoThisThing();
       } catch (Exception exception) {
     throw exception;
       }
 }
 public void AddItem(DownloaderTaskViewItem argdltvi)
 {
     this.thedltvitems.Add(argdltvi);
       base.OnPropertyChanged("TheListItems");
 }