當前位置: 首頁>>代碼示例>>C#>>正文


C# Net.DownloadProgressChangedEventArgs類代碼示例

本文整理匯總了C#中System.Net.DownloadProgressChangedEventArgs的典型用法代碼示例。如果您正苦於以下問題:C# DownloadProgressChangedEventArgs類的具體用法?C# DownloadProgressChangedEventArgs怎麽用?C# DownloadProgressChangedEventArgs使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


DownloadProgressChangedEventArgs類屬於System.Net命名空間,在下文中一共展示了DownloadProgressChangedEventArgs類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: ProgressChanged

 private void ProgressChanged(object sender, DownloadProgressChangedEventArgs downloadProgressChangedEventArgs)
 {
     progressBar1.Invoke(new Action(() =>
         {
             progressBar1.Value = downloadProgressChangedEventArgs.ProgressPercentage;
         }));
 }
開發者ID:SynoCam,項目名稱:synocam,代碼行數:7,代碼來源:DownloadProgress.cs

示例2: DownloadProgressChanged

        /// <summary>Updates the download visuals (progress bar, text %, etc.)</summary>
        private void DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
        {
            int index = GetDownloadFromWebClient((WebClient)sender);
            Download dld = (Download)clients[index]; //is this creating a copy?
            if (!dld.accountedFor)
            {
                dld.totalSize = e.TotalBytesToReceive;
                totalUpdateSize += e.TotalBytesToReceive;
                dld.accountedFor = true;
            }
            dld.completed = e.BytesReceived;
            clients[index] = dld; // put the copy into the array

            long tempTotal = 0;
            lstDownloadProgress.Items.Clear();
            //Should I make this next part thread safe? It isn't really an exact science, so I don't think it matters
            foreach (Download dl in clients)
            {
                tempTotal += dl.completed;
                lstDownloadProgress.Items.Add(dl);
            }

            totalUpdateRecieved = tempTotal;
            pbarDownload.Value = (int)(((double)totalUpdateRecieved / (double)totalUpdateSize) * 100);
            lblDownloadProgress.Text = "" + (int)(((double)totalUpdateRecieved / (double)totalUpdateSize) * 100) + "%";
        }
開發者ID:Gambini,項目名稱:Overgrowth-Update,代碼行數:27,代碼來源:DownloadingFunctions.cs

示例3: OnDownloadProgressChanged

        protected override void OnDownloadProgressChanged(DownloadProgressChangedEventArgs e)
        {
            if (dt.Ticks == 0)
            {
                dt = DateTime.Now;
            }
            time = (DateTime.Now.Ticks - dt.Ticks) / (TimeSpan.TicksPerMillisecond * 1000);

            if (sw.ElapsedMilliseconds == 0)
            {
                sw.Start();
            }

            float dbSec = sw.ElapsedMilliseconds / 1000;
            string strSpeed;
            try
            {
                strSpeed = clsMain.formatBytes(e.BytesReceived / dbSec);
            }
            catch
            {
                strSpeed = "";
            }

            //System.Diagnostics.Debug.Print(((DateTime.Now.Ticks - dt.Ticks) / (TimeSpan.TicksPerMillisecond*1000) ).ToString());
            //System.Diagnostics.Debug.Print(((time / 60) % 60).ToString());
            //System.Diagnostics.Debug.Print((e.BytesReceived.ToString() + "\t" + (DateTime.Now.Ticks - dt.Ticks).ToString()));
            DownloadProgressChangedIndex(e, intCurrentClassIndex, String.Format("{0:00}:{1:00}:{2:00}", (int)time / 3600, (int)((time / 60) % 60), (int)(time % 60)), strSpeed);
        }
開發者ID:ThunderStroke,項目名稱:youtubesniffer,代碼行數:29,代碼來源:clsDownload.cs

示例4: VideoProgressChanged

 private void VideoProgressChanged(object sender, DownloadProgressChangedEventArgs e)
 {
     _progressTextBlock.Text = String.Format("{0} Downloaded {1} of {2} bytes. {3} % Complete...",
                                             (string)e.UserState, e.BytesReceived, e.TotalBytesToReceive,
                                             e.ProgressPercentage);
     _progressBar.Value = e.ProgressPercentage;
 }
開發者ID:rudylee,項目名稱:WpfApp,代碼行數:7,代碼來源:AppUpdate.cs

示例5: Client_DownloadProgressChanged

 private void Client_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
 {
     if (this.ProgressChanged != null)
     {
         this.ProgressChanged(this, e.ProgressPercentage);
     }
 }
開發者ID:micheljung,項目名稱:gpgnetfix,代碼行數:7,代碼來源:WebDownloadMonitor.cs

示例6: client_DownloadProgressChanged

 void client_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
 {
     if (e.UserState as string == "pompeu")
     {
         //txtStatus.Text = e.BytesReceived.ToString() + " bytes received.";
     }
 }
開發者ID:aameijide,項目名稱:wp7-prestecPortatilUPF,代碼行數:7,代碼來源:MainPage.xaml.cs

示例7: Client_DownloadProgressChanged

 void Client_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
 {
     progressBar1.Maximum = Convert.ToInt32(e.TotalBytesToReceive);
     progressBar1.Value = Convert.ToInt32(e.BytesReceived);
     label5.Text = e.BytesReceived.ToString();
     label6.Text = e.TotalBytesToReceive.ToString();
 }
開發者ID:quantum1423-dustbin,項目名稱:OpenGeckoSharp-DEV,代碼行數:7,代碼來源:DLHandler.cs

示例8: HandleDownloadProgressChanged

        private void HandleDownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
        {
            //Console.WriteLine("SyncClientService - HandleDownloadProgressChanged - progressPercentage: {0} bytesReceived: {1} totalBytesToReceive: {2}", e.ProgressPercentage, e.BytesReceived, e.TotalBytesToReceive);

            string fileName = string.Empty;
            if(_audioFiles != null && _audioFiles.Count >= _filesDownloaded+1)
                fileName = Path.GetFileName(_audioFiles[_filesDownloaded].FilePath);

            _bytesDownloaded += e.BytesReceived - _lastBytesReceived;
            _lastBytesReceived = e.BytesReceived;

            if (OnDownloadIndexProgress != null)
                OnDownloadIndexProgress(e.ProgressPercentage, e.BytesReceived, e.TotalBytesToReceive);

            if (OnDownloadAudioFileProgress != null)
                OnDownloadAudioFileProgress(new SyncClientDownloadAudioFileProgressEntity(){
                    Status = "Downloading files...",
                    PercentageDone = ((float)_filesDownloaded / (float)_audioFiles.Count()) * 100f, 
                    FilesDownloaded = _filesDownloaded, 
                    TotalFiles = _audioFiles.Count(),
                    DownloadBytesReceived = e.BytesReceived,
                    DownloadTotalBytesToReceive = e.TotalBytesToReceive,
                    DownloadPercentageDone = ((float)e.BytesReceived / (float)e.TotalBytesToReceive) * 100f,
                    DownloadSpeed = GetDownloadSpeed(),
                    Errors = _errorCount, 
                    DownloadFileName = fileName,
                    Log = string.Empty
                });
        }
開發者ID:pascalfr,項目名稱:MPfm,代碼行數:29,代碼來源:SyncClientService.cs

示例9: DownloadStatusChanged

        private void DownloadStatusChanged(object sender, DownloadProgressChangedEventArgs e)
        {
            // Prozentualen Fortschritt in progressBar1 anzeigen
            progressBar2.Value = e.ProgressPercentage;

            statusLabel2.Text = e.ProgressPercentage + "% (" + e.BytesReceived + " von " + e.TotalBytesToReceive + " Bytes)";
        }
開發者ID:GamesOnGithub,項目名稱:Games-And-More-Extra-Stuff,代碼行數:7,代碼來源:LoadForm.cs

示例10: wc_DownloadProgressChanged

 public void wc_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
 {
     if (e.BytesReceived != 0)
     {
         this.Connected = true;
     }
 }
開發者ID:stjeong,項目名稱:OfficePresenter,代碼行數:7,代碼來源:TimeoutContext.cs

示例11: webClient_DownloadProgressChanged

 void webClient_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
 {
     test.Value = e.BytesReceived;
     //test.Value = e.ProgressPercentage;
     test.Maximum = e.TotalBytesToReceive;
     DownloadResultText.Text = "Downloaded " + e.BytesReceived + "/" + e.TotalBytesToReceive + "bytes, " + e.ProgressPercentage + "% completed.";
 }
開發者ID:trilok567,項目名稱:Windows-Phone,代碼行數:7,代碼來源:GetStringPage.xaml.cs

示例12: ProgressIndicator

 public ProgressIndicator(DownloadProgressChangedEventArgs args,string token = "")
 {
     Processed = args.BytesReceived;
     Remaining = args.TotalBytesToReceive;
     Percentage = args.ProgressPercentage;
     RequestToken = token;
 }
開發者ID:nisbus,項目名稱:reactive_cloudant,代碼行數:7,代碼來源:ProgressIndicator.cs

示例13: downloader_DownloadProgressChanged

 void downloader_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
 {
     double bytesIn = double.Parse(e.BytesReceived.ToString());
     double totalBytes = double.Parse(e.TotalBytesToReceive.ToString());
     double percentage = bytesIn / totalBytes * 100;
     this.Dispatcher.Invoke(()=>progressBar.Value = int.Parse(Math.Truncate(percentage).ToString()));
 }
開發者ID:nirvdrum,項目名稱:Battlelogium,代碼行數:7,代碼來源:UIDownloader.xaml.cs

示例14: ClientDownloadProgressChanged

 /// <summary>
 /// Callback by the web client when a new piece of file has been incrementally downloaded
 /// </summary>
 void ClientDownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
 {
     string progress = String.Format("Downloaded {0} of {1} Kb", e.BytesReceived / 1024, e.TotalBytesToReceive / 1024);
     UIThread(() => labelProgress.Text = progress);
     UIThread(() => progressBar.Maximum = (int) e.TotalBytesToReceive);
     UIThread(() => progressBar.Value = (int) e.BytesReceived);
 }
開發者ID:splintor,項目名稱:GitForce,代碼行數:10,代碼來源:FormDownload.cs

示例15: downloadProgressChanged

 private void downloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
 {
     if (e.ProgressPercentage != updateProgress.Value)
     {
         updateProgress.Value = e.ProgressPercentage;
     }
 }
開發者ID:RichieSams,項目名稱:RIFT_Meters,代碼行數:7,代碼來源:updater.cs


注:本文中的System.Net.DownloadProgressChangedEventArgs類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。