backgroundworker

Alternative to BackgroundWorker that accepts more than one argument?

The BackgroundWorker object allows us to pass a single argument into the DoWorkEventHandler. // setup/init: BackgroundWorker endCallWorker = new BackgroundWorker(); endCallWorker.DoWork += new DoWorkEventHandler(EndCallWorker_DoWork); ... endCallWorker.RunWorkerAsync(userName); // the handler: private void EndCallWorker_DoWork(object ...

help updating chart

I have two methods that work together and they make a big double array (every 1/1000000S 5000 item) and this array should show a chart (Dundas chart). But the chart is not updating. Please help me! Sorry for my bad English! This my code: using System; using System.Collections; using System.Collections.Generic; using System.ComponentM...

Asynchronous ObjectContext.SaveChanges() ?

Hi all! I want the SaveChanges of the ObjectContext (Win apps) to SaveChanges asynchronously, will show a marquee (or controllable?) progress bar (this I can easily implement) for the user while he is able to continue working. I basically want to override the SaveChanges of the ObjectContext. Has anyone thought about this before? ...

Implementing a thread-safe FTP file fetching daemon on Windows

Hello everyone, I'm starting to implement a simple daemon that basically fetches a file from an FTP location with the help of a BackgroundWorker component to kind of guarantee sort of thread safety there. Although I sort of feel I'm heading towards the right direction, I'm not completely familiar with the technologies involved, therefore...

BackgroundWorker Thread used for Serial port data processing Throwing "This BackgroundWorker is currently busy and cannot run multiple tasks concurrently"

Hello Guys, I am developing a application in C# which is getting data from Serial Port, Processing it and showing it to UI. The data is coming very fast between 5-50ms speed. Before I was not using any threads. and so application was relying on single App thread which was getting data from Serial Port, Processing data and showing it to U...

Thread creating BackgroundWorkers seems to queue up the Completed events

I am noticing some strange behaviour with BackgroundWorkers and the events they're firing where the events seem to be queuing up in one thread while the CPU isn't actually being used. Basically the design of the system is that, based on user interaction, a thread is created to send off a web request to fetch some data. Based on the res...

How can I alter XAML elements from a backgroundworker thread?

In the following code example, I want to change the color of the Foreground text of a TextBox from my BackgroundThread, but it gets the error: This thread cannot access this object since it is in another thread. What do I have to change in the code below so that the background worker thread can change the foreground color in the ...

How to access a WPF Object in the Dispatcher?

I am using the MVVM pattern to develop a WPF application. The app loads a captcha image from the server, and assigns it to an Image on the WPF form when ready. I am using a BackgroundWorker to do the threading for me, as follows: When the Window is being loaded, the following is called: BackgroundWorker _bgWorker = new BackgroundWork...

Background Worker Thread in WebService context

Ok, so i have Call1 in a webservice that will start a bacground worker thread to start doing some processing, but would like to have another call (Call2) that will monitor the original Worker Thread via a reference? Any suggestions on how to do this? I'd really like to stay away from a WinService to do my processing. As i need it to be ...

How could ProcessStartInfo.UseShellExecute = false result in odd behavior by FreeImageNet on a separate thread?

I am running a Process in a BackgroundWorker to resize images. If I set UseShellExecute = false on the process's startinfo, I get odd behaviour if I do any simultaneous image manipulation with the FreeImageNet library on the UI thread. The odd-behaviour is that when I go to close a new image via CloseMultiBitmap() the method appears to w...

C# backgroundWorker reports string?

How can I report a string (like "now searching file. . .", "found selection. . .") back to my windows.form from a backgroundWorker as well as a percentage. Additionally, I have a large class that contains the method I want to run in the backgroundWorker_Work. I can call it by Class_method(); but i am then unable to report my percentage d...

How can I call a method on a form from a method called from an external class from a backgroundWorker?

How can I call a method on a form from a method called from an external class from a backgroundWorker? I believe that delegates are somehow the answer to this question, but after spending time reading, I still am confused by this problem. This is in Visual Studio 2008, the backgroundWorker is run from the form and calls ExternalClass.Me...

BackgroundWorker used within collection items

I used a Backgroudworker to do some work in order to do some time consuming tasks. public void ConnectDataProvider() { bgw = new BackgroundWorker(); bgw.DoWork += new DoWorkEventHandler(bgw_DoWork); bgw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bgw_RunWorkerCompleted); } Another method ...

C# Making a delegate available to a class

I would like to make a delegate available to an entire class. The point of this is to allow a called method from an external class' backgroundWorker to continually report back through all of it's methods (ExternalClass.Run(); calls ExternalClass.Method2(); ExternalClass.Method3(); etc and they all need to send several progress reports. I...

.NET: How to wait correctly until BackgroundWorker completes?

Dear ladies and sirs. Observe the following piece of code: var handler = GetTheRightHandler(); var bw = new BackgroundWorker(); bw.RunWorkerCompleted += OnAsyncOperationCompleted; bw.DoWork += OnDoWorkLoadChildren; bw.RunWorkerAsync(handler); Now suppose I want to wait until bw finishes working. What is the right way to do so? My so...

Using a Background Worker - Update a ProgressBar on the progress of a Recursive Method

Hi guys, Below is a method that I want to ship off into a background worker but I am struggling how to do it based on how created my method. As you can it doesn't return anything which is ok but it expects a directoryInfo object everytime it is recalled. private void getSizeForTargetDirectory(DirectoryInfo dtar) { // g...

how to cancel background worker after specified time in c#

how to cancel background worker after specified time in c# or cancel not responding background worker. ...

Background Worker Process and Connection Timeout

Ok, I was deciding between a thread or BackgroundWorker process and based on the responses from this thread I decided to go with the BackgroundWorker. Here is the thing though, when I started the worker process it stopped half way with a connection timeout error to the database. This is normal when the process is run directly on the DB s...

Is there a way to send data to a BackgroundWorker after it has been started?

I know you can pass arguments through the RunWorkerAsync function call when you first start the backgroundworker, but can you pass it data after its already been started? Or would I need to create my own form of concurrency to handle passing data to it from a different thread? ...

Background works doesn't complete on gui thread

I have a background worker that is started on the main thread as shown It executes on a worker thread as expected but for some reason it completes on the worker thread which causes me issues if I try and update anything on the gui thread. I have tried a simplified setup on a test app and in this app the thread does end correctly on...