当前位置: 首页>>代码示例>>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;未经允许,请勿转载。