Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8924919
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T07:33:18+00:00 2026-06-15T07:33:18+00:00

I did what @Enigmativity write here it is: Action<int, ProgressBar, Label, Label, int, Button>

  • 0

I did what @Enigmativity write
here it is:

        Action<int, ProgressBar, Label, Label, int, Button> downloadFileAsync = (i, pb, label2, label1, ServID, button1) =>
    {
        var bd = AppDomain.CurrentDomain.BaseDirectory;
        var fn = bd + "/" + i + ".7z";
        var down = new WebClient();
        DownloadProgressChangedEventHandler dpc = (s, e) =>
        {
            label1.Text = "Download Update: " + i + " From: " + ServID;
            int rec =Convert.ToInt16(e.BytesReceived / 1024);
            int total =Convert.ToInt16(e.TotalBytesToReceive / 1024)  ;
            label2.Text = "Downloaded: " + rec.ToString() + " / " + total.ToString() + " KB";
            pb.Value = e.ProgressPercentage;
        };
        AsyncCompletedEventHandler dfc = null;  dfc = (s, e) =>
        {
            down.DownloadProgressChanged -= dpc;
            down.DownloadFileCompleted -= dfc;
            CompressionEngine.Current.Decoder.DecodeIntoDirectory(AppDomain.CurrentDomain.BaseDirectory + "/" + i + ".7z", AppDomain.CurrentDomain.BaseDirectory);
            File.Delete(fn);
               if (i == ServID)
                {

                   button1.Enabled = true;
                   label1.Text = "Game Is Up-To-Date.Have Fun!!";
                  label2.Text = "Done..";
               }
         down.Dispose();
        };

My only problam now is when the program is extarting the downloaded file

CompressionEngine.Current.Decoder.DecodeIntoDirectory(AppDomain.CurrentDomain.BaseDirectory + "/" + i + ".7z", AppDomain.CurrentDomain.BaseDirectory);

In some files its take time to extarct the downloaded file
so how i can tell the program to wait until decompressing is complete?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T07:33:20+00:00Added an answer on June 15, 2026 at 7:33 am

    Try defining a single lambda that will encapsulate a single async download and then call that in a loop.

    Here’s the lambda:

    Action<int> downloadFileAsync = i =>
    {
        var bd = AppDomain.CurrentDomain.BaseDirectory;
        var fn = bd + "/" + i + ".7z";
        var wc = new WebClient();
        DownloadProgressChangedEventHandler dpc = (s, e) =>
        {
            progressBar1.Value = e.ProgressPercentage;
        };
        AsyncCompletedEventHandler dfc = null;
        dfc = (s, e) =>
        {
            wc.DownloadProgressChanged -= dpc;
            wc.DownloadFileCompleted -= dfc;
            CompressionEngine.Current.Decoder.DecodeIntoDirectory(fn, bd);
            File.Delete(fn);
            wc.Dispose();
        };
        wc.DownloadProgressChanged += dpc;
        wc.DownloadFileCompleted += dfc;
        wc.DownloadFileAsync(new Uri(Dlpath + i + "/" + i + ".7z"), fn);
    };
    

    You’ll note that it nicely detaches all events and also correctly disposes of the WebClient instance.

    Now call it like this:

    while (i <= ServID)
    {
        downloadFileAsync(i);
        i++;
    }
    

    You’ll have to fiddle with the progress bar update to properly show the progress of all the files downloading, but in principle this should work for you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Did some searches here & on the 'net and haven't found a good answer
Did I not get enough sleep or what? This following code var frame=document.getElementById(viewer); frame.width=100;
Did anyone here a real company using JavaFX for real life applications? I did
Did ask a question about the same problem here: Silly problem with UTF8 but
Did anyone try to make access to api.php?action=parse&text= page with the POST request? on
did a search for this and didn't find an answer, so here goes... I
Did anybody write tests for ajax with jsunit? I don't now how to test
Did you used Dynamic websites before? you see its a good way for making
Did you ever have the following situation: you need to store information, but a
Did anyone tried to customize the window in which the quicktime is playing video?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.