コード例 #1
0
 private void OnDownloadProgressChangedHandler(object sender,
                                               MN.DownloadProgressChangedEventArgs e)
 {
     lock (SyncRoot) {
         if (e.ProgressPercentage != 0)
         {
             SetProgress(e.ProgressPercentage);
         }
     }
 }
コード例 #2
0
        private void UpdateProgress()
        {
            DownloadProgressChangedEventArgs args = null;

            lock (progressSync) {
                long totalBytesReceived = TotalBytesReceived;

                if (progressThisStep >= progressStep ||
                    totalBytesReceived == totalBytes &&
                    (totalBytes > 0 && progress != 100)) {

                    progress = Convert.ToInt32 (
                        (totalBytesReceived * 100) / totalBytes
                    );

                    if (progress >= 0) {
                        args = new DownloadProgressChangedEventArgs (
                            progress, null,
                            totalBytesReceived, totalBytes
                        );
                    }

                    progressThisStep = 0;
                }
            }

            if (args != null) {
                OnProgressChanged (args);
            }
        }
コード例 #3
0
        private void OnProgressChanged(DownloadProgressChangedEventArgs args)
        {
            EventHandler <DownloadProgressChangedEventArgs>
                handler = ProgressChanged;

            try
            {
                if (handler != null) {
                    handler (this, args);
                }
            } catch {}
        }