Exemplo n.º 1
0
 private void bi_DownloadProgress(object sender, DownloadProgressEventArgs e)
 {
     if (this.ImageDownLoadProgress != null)
     {
         this.ImageDownLoadProgress(e.Progress);
     }
 }
Exemplo n.º 2
0
 private void imageDownloader_DownloadProgress(object sender, DownloadProgressEventArgs e)
 {
     downloadingItem.DownloadRate = e.Progress;
     if (downloadingItem.DownloadRate < 100)
     {
         if (downloadingItem.DownloadStatusCode == DownloadStatus.Pending)
         {
             downloadingItem.DownloadStatus = AppResources.ImageStatusDownloading;
         }
     }
     else
     {
         if (downloadingItem.DownloadStatusCode == DownloadStatus.Downloading)
         {
             downloadingItem.DownloadStatus     = AppResources.ImageStatusDownloaded;
             downloadingItem.DownloadStatusCode = DownloadStatus.Downloaded;
             downloadingItem.DownloadNetwork    = string.Empty;
         }
         else
         {
             downloadingItem.DownloadStatus     = AppResources.ImageStatusAdding;
             downloadingItem.DownloadStatusCode = DownloadStatus.Saving;
         }
     }
 }
Exemplo n.º 3
0
 void bi_DownloadProgress(object sender, DownloadProgressEventArgs e)
 {
     if (e.Progress > 99)
     {
         imageProgress.IsIndeterminate = false;
     }
 }
Exemplo n.º 4
0
 /// <summary>
 /// Raises the DownloadProgress event.
 /// </summary>
 /// <param name="args">The arguments for the raised event.</param>
 private void OnDownloadProgress(DownloadProgressEventArgs args)
 {
     if (null != DownloadProgress)
     {
         DownloadProgress(this, args);
     }
 }
        void ISilverlightLoader.downloadProgressCallback(Uri packageSource, DownloadProgressEventArgs eventArgs)
        {
            float    offset = ((float)eventArgs.ProgressPercentage * 4 / 100f) * 1000;
            TimeSpan ts     = new TimeSpan(0, 0, 0, 0, (int)offset);

            LoadingTextCtrl.Text = eventArgs.ProgressPercentage.ToString() + "%";
        }
Exemplo n.º 6
0
 private void OnDownloadProgress(object sender, DownloadProgressEventArgs e)
 {
     if (e.Progress == 100)
     {
         return;
     }
 }
Exemplo n.º 7
0
 private void imageDownloader_DownloadProgress(object sender, DownloadProgressEventArgs e)
 {
     if (e.Progress < 100)
     {
         LoadingText.Text = AppResources.Loading + " " + e.Progress + "%";
     }
 }
 private void OnDownloadProgress(object sender, DownloadProgressEventArgs args)
 {
     if (args.IsComplete)
     {
         Process.Start("explorer.exe", "/Select, " + args.FullPath);
     }
 }
Exemplo n.º 9
0
 protected void OnDownloadProgressChanged(DownloadProgressEventArgs e)
 {
     if (DownloadProgress != null)
     {
         DownloadProgress(this, e);
     }
 }
Exemplo n.º 10
0
        public async Task DownloadAsync()
        {
            WebClient client = new WebClient();

            DateTime started = DateTime.Now;

            client.DownloadProgressChanged += (a, b) =>
            {
                lock (client)
                {
                    TimeSpan elapsed   = DateTime.Now - started;
                    TimeSpan estimated = TimeSpan.FromSeconds(
                        (b.TotalBytesToReceive - b.BytesReceived) /
                        (b.BytesReceived / elapsed.TotalSeconds));

                    var args = new DownloadProgressEventArgs()
                    {
                        DownloadPercentage = ((float)b.BytesReceived / b.TotalBytesToReceive) * 100,
                        TimeRemaining      = estimated
                    };

                    DownloadProgressChanged(null, args);
                }
            };

            await client.DownloadFileTaskAsync(URL, FileName);
        }
Exemplo n.º 11
0
        //下载进度
        private void OnDownloadProgress(object sender, IEventArgs e)
        {
            DownloadProgressEventArgs ne = (DownloadProgressEventArgs)e;

            Debug.Log(
                $"path:{ne.LocalPath} progress:{ne.DownloadProgress} bytes:{ne.DownloadBytes} speed:{ne.DownloadSpeed}");
        }
Exemplo n.º 12
0
 private void Bitmapimage_DownloadProgress(object sender, DownloadProgressEventArgs e)
 {
     Myprogressbar.Value = e.Progress;
     if (Myprogressbar.Value == 100)
     {
         Myprogressbar.Visibility = Visibility.Collapsed;
         BlurUiAsync();
     }
 }
Exemplo n.º 13
0
        // called on download progress of each package/file
        public void downloadProgressCallback(Uri packageSource, DownloadProgressEventArgs eventArgs)
        {
            float        percentageDownloadedAcurate = ((float)eventArgs.BytesReceived / eventArgs.TotalBytesToReceive) * 100;
            ProgressCtrl progressCtrl = m_packageSourceList[packageSource];
            string       packageName  = progressCtrl.Name;

            progressCtrl.LoadingTextCtrl.Text  = "Downloaded " + percentageDownloadedAcurate.ToString("##0") + "%";
            progressCtrl.ProgressBarCtrl.Value = eventArgs.ProgressPercentage;
        }
Exemplo n.º 14
0
        /// <summary>
        ///     Raises the dowload progress event.
        /// </summary>
        /// <param name="e"></param>
        protected void RaiseDownloadProgress(DownloadProgressEventArgs e)
        {
            EventHandler <DownloadProgressEventArgs> downloadProgress = _downloadProgress;

            if (downloadProgress != null)
            {
                downloadProgress(this, e);
            }
        }
Exemplo n.º 15
0
 public void bitmapimage_DownloadProgress(object sender, DownloadProgressEventArgs e)
 {
     try
     {
         item_status.Text       = "Image loading: " + e.Progress + "%\nor is not available.";
         item_status.Visibility = Visibility.Visible;
     }
     catch { }
 }
Exemplo n.º 16
0
        public void UpdateProgressBar(object sender, DownloadProgressEventArgs e)
        {
            Text.Text         = downloading_text + e.Progress + "%";
            ProgressBar.Width = e.Progress / 100.0 * (Width - 20);

            if (e.Progress == 100)
            {
                Close();
            }
        }
Exemplo n.º 17
0
        void _downloader_DownloadProgress(object sender, DownloadProgressEventArgs e)
        {
            if (ProgressValue == 0 && e.PercentComplete > 0)
            {
                OnDownloadStarted();
            }

            ProgressValue     = e.PercentComplete;
            CurrentActionText = e.Message;
        }
Exemplo n.º 18
0
        private void JpegImage_DownloadProgress(object sender, DownloadProgressEventArgs e)
        {
            var bitmap = sender as BitmapImage;
            var image  = ImagesViewModel.Images.FirstOrDefault(o => o.Post.JpegUrl == bitmap.UriSource.OriginalString);

            if (image != null)
            {
                image.JpegLoadProgress = e.Progress;
            }
        }
        private void Image_DownloadProgress(object sender, DownloadProgressEventArgs e)
        {
            var bitmap      = sender as BitmapImage;
            var ProgressBar = bitmap.GetValue(BitmapLoadingIndicatorProperty) as ProgressBar;

            if (ProgressBar == null)
            {
                return;
            }
            SetDownloadProgress(e.Progress);
        }
Exemplo n.º 20
0
 private void BitImage_DownloadProgress(object sender, DownloadProgressEventArgs e)
 {
     if (download)
     {
         ImageProgressBar.Value = e.Progress;
     }
     else
     {
         ImageProgressBar.Value = 0;
     }
 }
 private void Wallpaper_DownloadProgress(object sender, DownloadProgressEventArgs e)
 {
     if (e.Progress < 100)
     {
         IsLoading = true;
     }
     else
     {
         IsLoading = false;
     }
 }
Exemplo n.º 22
0
        /// <summary>
        /// 创建下载更新事件。
        /// </summary>
        /// <param name="serialId">下载任务的序列编号。</param>
        /// <param name="downloadPath">下载后存放路径。</param>
        /// <param name="downloadUri">下载地址。</param>
        /// <param name="CurrentProgress">当前进度。</param>
        /// <param name="userData">用户自定义数据。</param>
        /// <returns>创建的下载进度事件。</returns>
        public static DownloadProgressEventArgs Create(int serialId, string downloadPath, string downloadUri, float CurrentProgress, object userData)
        {
            DownloadProgressEventArgs downloadProgressEventArgs = ReferencePool.Acquire <DownloadProgressEventArgs>();

            downloadProgressEventArgs.SerialId        = serialId;
            downloadProgressEventArgs.DownloadPath    = downloadPath;
            downloadProgressEventArgs.DownloadUri     = downloadUri;
            downloadProgressEventArgs.CurrentProgress = CurrentProgress;
            downloadProgressEventArgs.UserData        = userData;
            return(downloadProgressEventArgs);
        }
Exemplo n.º 23
0
 internal void OnDownloadProgress(object sender, DownloadProgressEventArgs e)
 {
     if (InvokeRequired)
     {
         Core.UIManager.QueueUIJob(new DownloadProgressEventHandler(OnDownloadProgress), new object[] { sender, e });
     }
     else if (_progressLabel != null)
     {
         _progressLabel.Visible = true;
         _progressLabel.Text    = e.Message;
     }
 }
Exemplo n.º 24
0
 internal void OnDownloadTitleProgress(object sender, DownloadProgressEventArgs e)
 {
     if (InvokeRequired)
     {
         Core.UIManager.QueueUIJob(new DownloadProgressEventHandler(OnDownloadTitleProgress), new object[] { sender, e });
     }
     else
     if (_searchEnginesPane != null)
     {
         _searchEnginesPane.FeedTitle = e.Message;
     }
 }
Exemplo n.º 25
0
        void value_DownloadProgress(object sender, DownloadProgressEventArgs e)

        {
            ProgressChargement.Text = e.Progress.ToString() + " %";
            if (e.Progress == 100)

            {
                //this.Image.SourceUpdated
                //    this.Image.Source.
                StopAnimation();
            }
        }
Exemplo n.º 26
0
 private void BitImage_EpicDownloadProgress3(object sender, DownloadProgressEventArgs e)
 {
     s3 = e.Progress;
     if (count > 0)
     {
         ImageProgressBar.Value = (s1 + s2 + s3) / count;
     }
     if (ImageProgressBar.Value >= 100)
     {
         count = 0;
     }
 }
Exemplo n.º 27
0
        private void OnDownloadProgressAsync(DownloadProgressEventArgs e)
        {
            var handler = this.DownloadProgress;

            if (handler != null)
            {
                handler.BeginInvoke(this,
                                    e,
                                    handler.EndInvoke,
                                    null);
            }
        }
Exemplo n.º 28
0
 private void AnimationBehavior_OnDownloadProgress(DependencyObject d, DownloadProgressEventArgs e)
 {
     IsDownloading = true;
     if (e.Progress >= 0)
     {
         DownloadProgress = e.Progress;
         IsDownloadProgressIndeterminate = false;
     }
     else
     {
         IsDownloadProgressIndeterminate = true;
     }
 }
Exemplo n.º 29
0
 private void DownloadProgressHandler(object sender, DownloadProgressEventArgs e)
 {
     if (InvokeRequired)
     {
         Invoke((EventHandler<DownloadProgressEventArgs>)DownloadProgressHandler, sender, e);
         return;
     }
     var t = e.Task;
     DownloadControl c;
     if (downloadControls.TryGetValue(t, out c))
     {
         c.LoadedBytes = e.LoadedBytes;
         c.Percentage = e.Percentage;
     }
 }
 void ICefWebBrowserInternal.OnDownloadUpdated(DownloadUpdatedEventArgs e)
 {
     if (DownloadUpdated != null)
     {
         var di = e.DownloadedItem;
         var ea = new DownloadProgressEventArgs(di.Url, di.IsValid, di.IsInProgress, di.IsComplete, di.IsCanceled,
                                                di.CurrentSpeed, di.PercentComplete, di.TotalBytes, di.ReceivedBytes,
                                                di.FullPath, di.Id, di.SuggestedFileName, di.ContentDisposition, di.MimeType);
         InvokeHandler(DownloadUpdated, ea);
         if (ea.Cancel)
         {
             e.Callback.Cancel();
         }
     }
 }
Exemplo n.º 31
0
        /// <summary>
        /// Handles the DownloadProgressChanged event of the au control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="CCNetConfig.Updater.Core.DownloadProgressEventArgs"/> instance containing the event data.</param>
        void au_DownloadProgressChanged(object sender, DownloadProgressEventArgs e)
        {
            string fileName = e.UpdateFile.Location.ToString( );

            fileName = fileName.Substring(fileName.LastIndexOf("/"));
            if (this.InvokeRequired)
            {
                this.Invoke(new UpdateLabel(this.UpdateStatusLabel), new object[] { string.Format("Downloading {0} : {1}%", Program.GetUpdateVersion, e.Percentage.ToString()) });
                this.Invoke(new UpdateProgressBar(this.UpdateStatusProgressBar), new object[] { e.Percentage });
            }
            else
            {
                this.UpdateStatusLabel(string.Format("Downloading {0} : {1}%", Program.GetUpdateVersion, e.Percentage.ToString( )));
                this.UpdateStatusProgressBar(e.Percentage);
            }
        }
Exemplo n.º 32
0
 private void AnimationBehavior_OnDownloadProgress(DependencyObject d, DownloadProgressEventArgs e)
 {
     IsDownloading = true;
     if (e.Progress >= 0)
     {
         DownloadProgress = e.Progress;
         IsDownloadProgressIndeterminate = false;
     }
     else
     {
         IsDownloadProgressIndeterminate = true;
     }
 }
 private void ThreadWatcher_DownloadProgress(ThreadWatcher watcher, DownloadProgressEventArgs args)
 {
     lock (_downloadProgresses) {
         DownloadProgressInfo info;
         if (!_downloadProgresses.TryGetValue(args.DownloadID, out info)) return;
         info.DownloadedSize = args.DownloadedSize;
         _downloadProgresses[args.DownloadID] = info;
     }
 }
Exemplo n.º 34
0
        private void updater_DownloadProgress(object sender, DownloadProgressEventArgs e)
        {
            //this.filesProgressBar.Value = e.FilesTransferred;
            this.byteProgressBar.Maximum = Convert.ToInt32(e.BytesTotal);
            this.byteProgressBar.Value = Convert.ToInt32(e.BytesTransferred);

            UpdateList("In corso aggiornamento del manifest: " + e.Manifest.ManifestId +
                "- Files: " + e.FilesTransferred + "/" + e.FilesTotal +
                " - Bytes: " + e.BytesTransferred + "/" + e.BytesTotal);
        }
Exemplo n.º 35
0
 static void ShowProgress(Series s, DownloadProgressEventArgs e)
 {
     Console.WriteLine("{0}: Completed [{1}/{2}]: {3} ({4}) | Found {5} Artwork.", DateTime.Now, e.SeriesDownloaded, e.SeriesTotal, s.SeriesName, s.SeriesId, s.ArtWorks.Count);
 }