Esempio n. 1
0
        private void download(FileInfo file, string source, Item f)
        {
            Directory.CreateDirectory(file.DirectoryName);

            try
            {
                WebClientMSJ download = new WebClientMSJ();
                download.item = f;
                download.DownloadProgressChanged += new DownloadProgressChangedEventHandler(download_DownloadProgressChanged);
                download.DownloadFileCompleted   += new System.ComponentModel.AsyncCompletedEventHandler(download_DownloadFileCompleted);
                f.row.Cells[1].Value              = "Downloading";
                download.DownloadFileAsync(new Uri(source), file.FullName);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Esempio n. 2
0
        void download_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
        {
            WebClientMSJ client = sender as WebClientMSJ;

            client.item.row.Cells[2].Value = e.ProgressPercentage;
        }
Esempio n. 3
0
        void download_DownloadFileCompleted(object sender, System.ComponentModel.AsyncCompletedEventArgs e)
        {
            WebClientMSJ client = sender as WebClientMSJ;

            client.item.row.Cells[1].Value = "File Updated";
        }
        private void download(FileInfo file, string source, Item f)
        {
            Directory.CreateDirectory(file.DirectoryName);

            try
            {
                WebClientMSJ download = new WebClientMSJ();
                download.item = f;
                download.DownloadProgressChanged += new DownloadProgressChangedEventHandler(download_DownloadProgressChanged);
                download.DownloadFileCompleted += new System.ComponentModel.AsyncCompletedEventHandler(download_DownloadFileCompleted);
                f.row.Cells[1].Value = "Downloading";
                download.DownloadFileAsync(new Uri(source), file.FullName);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }