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

  • SEARCH
  • Home
  • 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 3213718
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T14:58:36+00:00 2026-05-17T14:58:36+00:00

Because I have a tool that needs to do a lot of work at

  • 0

Because I have a tool that needs to do a lot of work at one point, I want to show a window with some text and a progressbar while doing the work.

My problem is, that because of the huge load of the work, the window never gets drawn or updated.

I know that I usually should use an extra thread for the work, but I have to use 2 collections and the database service from the current thread.

The current code is something like

StatusWindow SW = new StatusWindow();
StatusViewModel SVM = new StatusViewModel();

SVM.MaxNum = BigNumber;

SW.Show();

for (int i=0; i<BigNumber; i++)
{
    List<AType> ItemsToCreate = Func1();
    List<AType> ItemsToDelete = Func2();

    foreach (AType cItem in ItemsToCreate)
        DB.CreateItem(cItem);

    foreach (AType cItem in ItemsToDelete)
        DB:DeleteItem(cItem);

    SVM.CurrentNum = i;
}
SW.Close();

I also read about the Dispatcher, but i don’t think it is very usable in this scenario, since there would be too much access to the main thread.

Any suggestions?
Thanks

  • 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-05-17T14:58:37+00:00Added an answer on May 17, 2026 at 2:58 pm

    You can pass the two collections and whatever else you’d like to worker threads as long as the objects you are accessing can be accessed from different threads.

    int[] arrayofInt = new int[10]
    ThreadPool.QueueUserWorkItem(s =>
            {
                //access the array in the worker thread
                arrayofInt[0] = 10;
            });
    

    When finished with the work, you need to send a message to the dialog that it should be closed now. Do that by firing an event in your thread that is handled by your dialog.

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

Sidebar

Related Questions

I need to know because I have to explicitly close some remote resources that
EDIT: I don't want to delete the post because I have learned a lot
I have a task that's driving me crazy because i have no clue where
We develop some product using an internal design tool that stores information in XML
I have designed an user interface for a tool where the user needs to
I have a task at work that involves converting legacy SGM files into XML.
I have created a simple command line tool that outputs hello world. This is
I'm looking for a diff/compare tool that shows differing lines from two text files,
I have some builds that use NCover for test coverage analysis, and some that
I'm assigned to a project (PHP/MySQL) that needs some review and possibly fixes. As

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.