473,396 Members | 1,900 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

[C#] One BackgroundWorker for many tasks

Hello!
I have a Windows Form with many buttons which do different time-consuming things. Currently, for each of these operations I have a separate BackgroundWorker, but it would be better if I had only one, since I'm not going to have two BackgroundWorkers run at the same time.
Is it possible to use only one BackgroundWorker, and changing the DoWork delegate each time?
I've seen that DoWork can be changed only via the += and -= operators, so it seems to me that if I want it to perform a single operation, I have to remove the current one set for DoWork (which means I need to store the last operation executed by the BackgroundWorker).
Any suggestions?
Thanks!
Oct 24 '08 #1
0 967

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: JHoletzeck | last post by:
Is it possible to set the stack size for the thread created by BackgroundWorker like in the API call _beginthread? If not is the stack size a default or the one I set for the whole application?...
5
by: Rob R. Ainscough | last post by:
I'm using a BackgroundWorker to perform a file download from an ftp site. Per good code design practices where I separate my UI code from my core logic code (in this case my Download file method in...
0
by: andycee | last post by:
Hi, I'm working on an app to filter images (by size, EXIF info etc..) and display as a slideshow. To allow the worker thread to continue running whilst performing the longer tasks such as loading...
2
by: jimmy | last post by:
Does someone know why BackGroundWorker.ReportProgress method doesn't accept strings ? You can't pass integer always for a progress meter as percentage completed cannot be calculated in many...
5
by: redear | last post by:
Is there a way to immediately terminate a BackgroundWorker thread? My problem is that the BackgroundWorker starts with a call to My.Computer.FileSystem.GetFiles that can run for a very long time if...
4
by: BR | last post by:
Hi, I am writing a small utility to perform system maintainence tasks on Windows. In this, I am launching a MMC snapin as a process using BackGroundWorker and using the "RunWorkerCompleted"...
3
by: Piotrekk | last post by:
I have a question. One day i have been working with threads. Thread had 'while' loop that checked locked value telling the thread when application was closing ( in Dispose method i set locked...
3
by: Coaster | last post by:
I want to create a "thread manager" class to manage an array of backgroundworkers. I'd like this thread manager class to live in a class library and I wasn't sure if it was possible to make the...
1
by: AAaron123 | last post by:
Is the following OK in Backgroundworker: Private Sub backgroundWorker1_DoWork(ByVal sender As Object, ByVal e As DoWorkEventArgs) Handles backgroundWorker1.DoWork Static index As Integer = 700...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.