private void DownloadProgress(DownloadOperationItem item)
        {
            BackgroundDownloadProgress currentProgress = item.download.Progress;
            BackgroundTransferStatus   status          = currentProgress.Status;
            int percentComplete = 0;

            if (currentProgress.TotalBytesToReceive > 0)
            {
                percentComplete = (int)((currentProgress.BytesReceived * 100) / currentProgress.TotalBytesToReceive);
            }

            var ignore = this.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                item.stateText       = status.ToString();
                item.percentComplete = percentComplete;
            });
        }
Пример #2
0
 private TransferStatus ToTransferStatus(BackgroundTransferStatus status)
 {
     return((TransferStatus)Enum.Parse(typeof(TransferStatus), status.ToString()));
 }