Exemple #1
0
        private static void UpdateTitleInfo(Downloader.DownloadProgressChangedEventArgs e)
        {
            double nonZeroSpeed = e.BytesPerSecondSpeed + 0.0001;
            int    estimateTime = (int)((e.TotalBytesToReceive - e.ReceivedBytesSize) / nonZeroSpeed);
            bool   isMinutes    = estimateTime >= 60;
            string timeLeftUnit = "seconds";

            if (isMinutes)
            {
                timeLeftUnit  = "minutes";
                estimateTime /= 60;
            }

            if (estimateTime < 0)
            {
                estimateTime = 0;
                timeLeftUnit = "unknown";
            }

            string avgSpeed            = CalcMemoryMensurableUnit(e.AverageBytesPerSecondSpeed);
            string speed               = CalcMemoryMensurableUnit(e.BytesPerSecondSpeed);
            string bytesReceived       = CalcMemoryMensurableUnit(e.ReceivedBytesSize);
            string totalBytesToReceive = CalcMemoryMensurableUnit(e.TotalBytesToReceive);
            string progressPercentage  = $"{e.ProgressPercentage:F3}".Replace("/", ".");

            Console.Title = $"{progressPercentage}%  -  " +
                            $"{speed}/s (avg: {avgSpeed}/s)  -  " +
                            $"{estimateTime} {timeLeftUnit} left    -  " +
                            $"[{bytesReceived} of {totalBytesToReceive}]";
        }
 private void Downloader_DownloadProgressChanged(object sender, Downloader.DownloadProgressChangedEventArgs e)
 {
     DispatcherQueue.TryEnqueue(() =>
     {
         if (ProgressStatus.IsIndeterminate == true)
         {
             ProgressStatus.IsIndeterminate = false;
         }
         ProgressStatus.Value = e.ProgressPercentage;
     });
 }
Exemple #3
0
        //private static void OnChunkDownloadProgressChanged(object sender, Downloader.DownloadProgressChangedEventArgs e)
        //{

        //    ChildProgressBar progress = ChildConsoleProgresses.GetOrAdd(e.ProgressId, id =>
        //        ConsoleProgress?.Spawn(10000, $"chunk {id}", ChildOption));
        //    progress.Tick((int)(e.ProgressPercentage * 100));
        //}
        private static void OnDownloadProgressChanged(object sender, Downloader.DownloadProgressChangedEventArgs e)
        {
            ConsoleProgress.Tick((int)(e.ProgressPercentage * 100));
            UpdateTitleInfo(e);
        }
Exemple #4
0
 private void DownloadService_DownloadProgressChanged(object sender, Downloader.DownloadProgressChangedEventArgs e)
 {
     prgStatus.Value = e.ProgressPercentage;
     txtStatus.Text  = $"Downloaded {ConvertBytesToMegabytes(e.BytesReceived):N2} MB of {ConvertBytesToMegabytes(e.TotalBytesToReceive):N2} MB  -  {(int)e.ProgressPercentage} %";
 }
 private void OnDownloadProgressChanged(object sender, Downloader.DownloadProgressChangedEventArgs e)
 {
     intermation.Speed    = Math.Round(e.BytesPerSecondSpeed / 512 / 1024, 1);
     intermation.Progress = (int)e.ProgressPercentage;
 }