/// <summary>
        /// The on download progress.
        /// </summary>
        /// <param name="progress">
        /// The progress.
        /// </param>
        public void OnDownloadProgress(DownloadProgressInfo progress)
        {
            this.progressInfo = progress;
            if (null != this.clientProxy)
            {
                this.clientProxy.OnDownloadProgress(progress);
            }

            if (progress.OverallTotal <= 0)
            {
                // we just show the text
                this.notification.TickerText = new String(this.currentTitle);
                this.notification.Icon       = Android.Resource.Drawable.StatSysDownload;
                this.notification.SetLatestEventInfo(this.context, this.label, this.currentText, this.PendingIntent);
                this.currentNotification = this.notification;
            }
            else
            {
                this.customNotification.CurrentBytes  = progress.OverallProgress;
                this.customNotification.TotalBytes    = progress.OverallTotal;
                this.customNotification.Icon          = Android.Resource.Drawable.StatSysDownload;
                this.customNotification.PendingIntent = this.PendingIntent;
                this.customNotification.Ticker        = string.Format("{0}: {1}", this.label, this.currentText);
                this.customNotification.Title         = this.label;
                this.customNotification.TimeRemaining = progress.TimeRemaining;
                this.currentNotification = this.customNotification.UpdateNotification(this.context);
            }

            this.notificationManager.Notify(NotificationId, this.currentNotification);
        }
        /// <summary>
        /// The on download progress.
        /// </summary>
        /// <param name="progress">
        /// The progress.
        /// </param>
        public void OnDownloadProgress(DownloadProgressInfo progress)
        {
            this.progressInfo = progress;
            if (null != this.clientProxy)
            {
                this.clientProxy.OnDownloadProgress(progress);
            }

			if (progress.OverallTotal <= 0)
			{
				// we just show the text
				this.notification.TickerText = new String(this.currentTitle);
				this.notification.Icon = Android.Resource.Drawable.StatSysDownload;
				this.notification.SetLatestEventInfo(this.context, this.label, this.currentText, this.PendingIntent);
				this.currentNotification = this.notification;
			}
			else
			{
				this.customNotification.CurrentBytes = progress.OverallProgress;
				this.customNotification.TotalBytes = progress.OverallTotal;
				this.customNotification.Icon = Android.Resource.Drawable.StatSysDownload;
				this.customNotification.PendingIntent = this.PendingIntent;
				this.customNotification.Ticker = string.Format("{0}: {1}", this.label, this.currentText);
				this.customNotification.Title = this.label;
				this.customNotification.TimeRemaining = progress.TimeRemaining;
				this.currentNotification = this.customNotification.UpdateNotification(this.context);
			}

			this.notificationManager.Notify(NotificationId, this.currentNotification);
        }
Exemplo n.º 3
0
        /// <summary>
        /// The on update validation ui.
        /// </summary>
        /// <param name="handler">
        /// The handler.
        /// </param>
        private void OnUpdateValidationUi(ZipFileValidationHandler handler)
        {
            var info = new DownloadProgressInfo(
                handler.TotalBytes, handler.CurrentBytes, handler.TimeRemaining, handler.AverageSpeed);

            this.RunOnUiThread(() => this.OnDownloadProgress(info));
        }
 public void OnDownloadProgress(DownloadProgressInfo progress)
 {
     this.progressBar.Max = (int)(progress.OverallTotal >> 8);
     this.progressBar.Progress = (int)(progress.OverallProgress >> 8);
     this.progressFractionTextView.Text = Helpers.GetDownloadProgressString(progress.OverallProgress, progress.OverallTotal);
 }
Exemplo n.º 5
0
 /// <summary>
 /// Sets the state of the various controls based on the progressinfo
 /// object sent from the downloader service.
 /// </summary>
 /// <param name="progress">
 /// The progressinfo object sent from the downloader service.
 /// </param>
 public void OnDownloadProgress(DownloadProgressInfo progress)
 {
     // this.averageSpeedTextView.Text = string.Format("{0} Kb/s", Helpers.GetSpeedString(progress.CurrentSpeed));
     // this.timeRemainingTextView.Text = string.Format(
     //    "Verbleibende Zeit: {0}", Helpers.GetTimeRemaining(progress.TimeRemaining));
     this.progressBar.Max = (int)(progress.OverallTotal >> 8);
     this.progressBar.Progress = (int)(progress.OverallProgress >> 8);
     this.progressPercentTextView.Text = string.Format(
         "{0}%", progress.OverallProgress * 100 / progress.OverallTotal);
     this.progressFractionTextView.Text = Helpers.GetDownloadProgressString(
         progress.OverallProgress, progress.OverallTotal);
 }