how to use text based console progress bar in multithreading C#
<p>Hi I have a program that downloads + extracts the files in parallel (in threads).
it is a console app,and I want to show the Progress Bar for each operation in each thread.
for eg: </p>

<p>File 1 [==========35%            ] 35mb of 100mb downloaded</p>

<p>File 2 [====20%                  ] 20mb of 100mb downloaded</p>

<p>File1 Downloaded,</p>

<p>File 1 [=============50%        ] 50% extracted.
and so on.</p>

<p>note: I am able to show the console outputs as Code below, but would like to use this Progress Bar in my Console APP.</p>

<p>How can I use solution proposed in <a href="https://gist.github.com/DanielSWolf/0ab6a96899cc5377bf54" rel="nofollow">https://gist.github.com/DanielSWolf/0ab6a96899cc5377bf54</a> in this case ?</p>

<pre><code>public static void DownloadAndGetFiles()
    {
        try
        {
            Parallel.ForEach(FileIds, currentId =&gt;

            { 
               int currentId = FileIds.Id 
               clientFileDownload(currentId);
            });
        }

        catch (Exception e)
        {

        }
    }

private static void clientFileDownload(int currentId)
{
    WebClient client = new WebClient();
    client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(client_DownloadProgressChanged);
    client.DownloadFileCompleted += new AsyncCompletedEventHandler(client_DownloadFileCompleted);
    string downloadedFile = @"d:\tmp\";
    client.DownloadFileAsync(new Uri(currentId.URL), downloadedFile); //some URL
    while (client.IsBusy) { }
    string temp = ExtractAndRename(currentId);
}

private static void client_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
{
   //Prints: "Downloaded 3mb of 61.46mb  (4%)"
   Console.WriteLine("Downloaded "
              + ((e.BytesReceived / 1024f) / 1024f).ToString("#0.##") + "mb"
              + " of "                 
              + ((e.TotalBytesToReceive / 1024f) / 1024f).ToString("#0.##") + "mb"
              + "  (" + e.ProgressPercentage + "%)");
}

private static string ExtractAndRename(int currentId)
{
        //using SevenZipExtractor lib http://stackoverflow.com/questions/20898794/how-to-extract-files-in-my-archive-one-by-one-using-sevenzipsharp
        SevenZipExtractor extractor = new SevenZipExtractor(@"d:\tmp\" + id.Name);
        extractor.Extracting += extractor_Extracting;
        extractor.ExtractArchive(@"d:\tmp\" + extractName[0]);
        return (@"d:\tmp\" + extractName[0]);
}

public static void extractor_Extracting(object sender, SevenZip.ProgressEventArgs p)
{
              Console.ForegroundColor = ConsoleColor.Yellow;
              Console.Write("\b\b{0}% Extracted", p.PercentDone);
              Console.ResetColor();
}
</code></pre>