tagged [backgroundworker]

How can I create WPF controls in a background thread?

How can I create WPF controls in a background thread? I have method which create background thread to make some action. In this background thread I create object. But this object while creating in run...

Background worker exception handling

Background worker exception handling I am slightly confused on how to deal with an exception. I have a background worker thread that runs some long running process. My understanding is if an exception...

14 Dec at 10:44

In WPF, what is the equivalent of Suspend/ResumeLayout() and BackgroundWorker() from Windows Forms

In WPF, what is the equivalent of Suspend/ResumeLayout() and BackgroundWorker() from Windows Forms If I am in a function in the code behind, and I want to implement displaying a "Loading..." in the st...

13 Apr at 12:22

Is thread-local storage persisted between backgroundworker invocations?

Is thread-local storage persisted between backgroundworker invocations? Are backgroundworker threads re-used? Specifically, if I set a named data slot (thread-local storage) during the DoWork() method...

Alternative to BackgroundWorker that accepts more than one argument?

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 en...

C#- background worker's CancelAsync() not working?

C#- background worker's CancelAsync() not working? I want to abort the process but not able to do so, I am using Background worker with my functions of processing. ``` public void Init() { bw = new ...

19 Aug at 13:36

How to "kill" background worker completely?

How to "kill" background worker completely? I am writing a windows application that runs a sequence of digital IO actions repeatedly. This sequence of actions starts when the user click a "START" butt...

29 Apr at 03:43

How to stop BackgroundWorker on Form's Closing event?

How to stop BackgroundWorker on Form's Closing event? I have a form that spawns a BackgroundWorker, that should update form's own textbox (on main thread), hence `Invoke((Action) (...));` call. If in ...

"Operation already completed" error when using Progress Bar

"Operation already completed" error when using Progress Bar I currently have the following: ``` MovieProcessor movieProcessor = new MovieProcessor(SelectedPath, this); BackgroundWorker worker = new Ba...

30 Jan at 06:26

Why BackgroundWorker always is busy?

Why BackgroundWorker always is busy? I realized something strange in my background worker in my WPF application. What I'm trying to accomplish right now is to wait until the BW finishes to start anoth...

Unhandled exceptions in BackgroundWorker

Unhandled exceptions in BackgroundWorker My WinForms app uses a number of [BackgroundWorker](http://msdn.microsoft.com/en-us/library/system.componentmodel.backgroundworker.aspx) objects to retrieve in...

InvalidOperationException - object is currently in use elsewhere

InvalidOperationException - object is currently in use elsewhere I've gone through [this SO question](https://stackoverflow.com/questions/246058/system-invalidoperationexception-the-object-is-currentl...

23 May at 11:47

Using parameters in BackgroundWorker handlers

Using parameters in BackgroundWorker handlers For passing data to a `BackgroundWorker`'s `DoWork` I use a separate wrapper class' instance: ``` MyParams mpar = new MyParams(); ... mpar.Par1 = par1val;...

"This BackgroundWorker states that it doesn't report progress." - Why?

"This BackgroundWorker states that it doesn't report progress." - Why? i am new to this backgroundworker thing i have read some articles about how to create one this is what it produced ``` private v...

25 Feb at 23:12

How to stop BackgroundWorker correctly

How to stop BackgroundWorker correctly I have a form with 2 comboboxes on it. And I want to fill `combobox2.DataSource` based on `combobox1.Text` and `combobox2.Text` (I assume that the user has compl...

20 Dec at 00:59

How can I make a background worker thread set to Single Thread Apartment?

How can I make a background worker thread set to Single Thread Apartment? I am creating an automated test running application. In this part of the application, I am working on a polling server. It wor...

Displaying wait cursor in while backgroundworker is running

Displaying wait cursor in while backgroundworker is running During the start of my windows application, I have to make a call to a web service to retrieve some default data to load onto my application...

How to use a BackgroundWorker?

How to use a BackgroundWorker? I know it has 3 methods. In my program I have a method to send a message. It is often late and the program sometimes doesn't send the message at all in response to a but...

5 Mar at 18:41

Running a method in BackGroundWorker and Showing ProgressBar

Running a method in BackGroundWorker and Showing ProgressBar What I want is when some method is doing some task UI keeps itself active and I want to show the progress of the work in a progress-bar. I ...

Popping a MessageBox for the main app with Backgroundworker in WPF

Popping a MessageBox for the main app with Backgroundworker in WPF In a WPF app, I am using a BackgroundWorker to periodically check for a condition on the server. While that works fine, I want to pop...

Spawn Multiple Threads for work then wait until all finished

Spawn Multiple Threads for work then wait until all finished just want some advice on "best practice" regarding multi-threading tasks. as an example, we have a C# application that upon startup reads d...

20 Apr at 02:50

Refresh UI with a Timer in WPF (with BackgroundWorker?)

Refresh UI with a Timer in WPF (with BackgroundWorker?) We have an application in WPF that shows data via ObservableCollection. After 5 minutes, I want to refresh the data. I thought I could use the `...

6 Jul at 04:57

How to wait for BackgroundWorker to finish and then exit console application

How to wait for BackgroundWorker to finish and then exit console application I have written a sample console application to test backgroundworker using one of the examples posted here in Stackoverflow...

How is BackgroundWorker.CancellationPending thread-safe?

How is BackgroundWorker.CancellationPending thread-safe? The way to cancel a BackgroundWorker's operation is to call `BackgroundWorker.CancelAsync()`: In a BackgroundWorker.DoWork event handler, we ch...

report progress backgroundworker from different class c#

report progress backgroundworker from different class c# In my .NET C# project I have used a "BackgroundWorker" to call a method in a different class. The following is the source-code of my main form ...

23 May at 11:47