backgroundworker

Using BackgroundWorker to update ListView

Hi all I am trying to update a listview from my backgroundworker. On the ProgressChanged event, I am passing back ProgressPercentage and a custom object called OperationInfo in the UserState object. OperationInfo has 4 properties: Operation(string), Success(boolean), Count(int), and AdditionalMessage(string) The below code updates my ...

Best Practice for BackGroundWorker in WinForms using an MVP architecture

I am working on a winforms project. I am implementing an MVP architecture. I have some processing intensive jobs running at the presenter (Reading from file system and performing bulk inserts to a DB). I would like to perform these operations in a background thread without locking up the UI and update controls on my view (progress bar, a...

How to Get Results From a Background Process

I am designing a Ruby on Rails application that requests XML feeds, reads them in, and parses them into objects to be used in views. Since the request for the XML feed and subsequent receipt of it can take several seconds from some sources to complete I need a way to offload these tasks from my front-line application tier. I do not want ...

Patterns for delegating work to multiple threads

I'm updating a WinForms application that uses a BackgroundWorker to do something useful when a button is pressed. The trouble is, "something useful" iterates sequentially through a long list of things to do, and can take quite a while to complete. I'm considering having the button press event create multiple BackgroundWorkers instead o...

Want to Call Same BackgroundWorker Multiple Times without using Application.DoEvents

I'm running in to a problem that I was able to fix with Application.DoEvents, but don't want to leave that in because it might introduce all sorts of nasty problems. Background: Our app is primarily a desktop app that makes many calls to a web service. We control everything but changes to the overall system design are not going to be s...

File.Exists() returns false, but not in debug

I'm being completely confused here folks, My code throws an exception because File.Exists() returns false public override sealed TCargo ReadFile(string fileName) { if (!File.Exists(fileName)) { throw new ArgumentException("Provided file name does not exist", "fileName"); } Visual studio breaks at the throw stateme...

GUI freezing after datagridviews have been updated using backgroundworkers

I have made an application which runs three backgroundworkers simultaneously. It basically updates three datagridviews, which it is doing spot on. My problem is if I press maximizebox button or anywhere in any of the datagridview the program hangs for quite a long time. I am able to use the horizontal scroll but not vertical scrolls. I h...

C# Help with a basic pedagogic example of a BackGroundWorker process populating a DataGridView

Scenario: I have a windows form that holds a DataGridWiew with 3 pre-defined columns. I have 3 variables declared outside the function and assigned to inside the function. I have a function that enumerates stuff and puts it in the 3 columns, line by line: string VARIABLE1; string VARIABLE2; string VARIABLE3; private void FunctionEnume...

Multi-Threading in .NET

Hi all.. I wrote this program, that is supposed to read about 5000 email address and send an pre-defined html mail. I am using the background worker component. The problem is this: I have wired up the method who is supposed to send the mail. But I am calling another method that is supposed to append the body html to the salutation, like...

Long Running Stored Proc - Report Progress Using BackgroundWorker & Timer

While a long running stored proc (RMR_Seek) is executing (called via a Linq-To-SQL data context) I am trying to call another stored proc (RMR_GetLatestModelMessage) to check a table for the latest status message. The long running stored proc updates the table in question with status messages as it executes. I want to display the status...

Cancelling Background Tasks in C#

When my C# application closes it sometimes gets caught in the cleanup routine. Specifically, a background worker is not closing. This is basically how I am attempting to close it: private void App_FormClosing(object sender, FormClosingEventArgs e) { backgroundWorker1.CancelAsync(); while (backgroundWorker1.IsBus...

Is BackgroundWorker suitable for long-running operation?

any idea suggestion about BGW for long-running operation? ...

BackgroundWorker is cool, but only report progress

It will be cooler, if BGW can report more than just progress, such as status, etc, any better alternative/workaround if i want more than just progress? ...

Best practice for multiple long-methods using backgroundworker

I have a form that has many long-methods. My quest is: What is the best practice? Use anonymous method and only one backgroundworker or create an instance of BackgroundWorker to each long-method. Please help. Thanks. ...

Winforms application hangs when switching to another app

Hi, I believe I have a potential threading issue. I have a user control that contains the following code: private void btnVerify_Click(object sender, EventArgs e) { if (!backgroundWorkerVerify.IsBusy) { backgroundWorkerVerify.RunWorkerAsync(); } } private void backgroundWorkerVerify_DoW...

How can I debug an unhandled exception in code called from a BackgroundWorker?

I am running some import code asynchronously from a simple WinForms app using a BackgroundWorker object and its DoAsync() method. I had a problem where I didn't know that exceptions were being thrown and the thread was prematurely dying. I eventually discovered this, and now know when an exception is thrown after reading Unhandled exce...

update variable based upon results from .NET backgroundworker

I've got a C# program that talks to an instrument (spectrum analyzer) over a network. I need to be able to change a large number of parameters in the instrument and read them back into my program. I want to use backgroundworker to do the actual talking to the instrument so that UI performance doesn't suffer. The way this works is - 1) s...

BackgroundWorker Not working in VSTO

I have a background worker. Before I invoke the worker I disable a button and make a gif visible. I then invoke the runworkerasync method and it runs fine until comleteion. On the 'RunWorkerCompleted()' I get a cross thread error. Any idea why? private void buttonRun_Click(object sender, EventArgs e) { if (comboBoxFi...

Canceling BackgroundWorker within the Thread

I have a longer running multi-step process using BackgroundWorker and C#. I need to be sure that each step is completed successfully before moving on to the next step. I have seen many references to letting the BackgroundWorker catch errors and canceling from clicking on a Cancel button, but I want to check for an error myself and then g...

Updating a status on a Winform in BackgroundWorker

I have a multi-step BackgroundWorker process. I use a marquee progress bar because several of these steps are run on a iSeries server so there isn't any good way to determine a percentage. What I am envisioning is a label with updates after every step. How would you recommend updating a label on a winform to reflect each step? Figured I...