Skip to content

What is the best way to use Progress? #162

Discussion options

You must be logged in to vote

@reneduesmann Below is some code that will download some files using HttpClient and await Task.WhenAll and shows progress.
The example uses C# 9, top-level programs, and Spectre.Console version 0.33.1-preview.0.1.

Hope it helps!

using Spectre.Console;
using System;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Threading.Tasks;

var client = new HttpClient();
var items = new (string name, string url)[]
{
    ("Ubuntu 20.04", "https://releases.ubuntu.com/20.04.1/ubuntu-20.04.1-desktop-amd64.iso"),
    ("Spotify", "https://download.scdn.co/SpotifySetup.exe"),
    ("Windows Terminal", "https://github.com/microsoft/terminal/releases/download/v1.5.3242.0/Microsoft.Win…

Replies: 4 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by patriksvensson
Comment options

You must be logged in to vote
1 reply
@patriksvensson
Comment options

Comment options

You must be logged in to vote
2 replies
@patriksvensson
Comment options

@brickscrap
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants
Converted from issue

This discussion was converted from issue #162 on December 13, 2020 18:01.