My winform calls a class which performs some copying actions. I'd like to show the progress of this on a form.
I'd like to use the Backgroundworker, but I don't know how to report progress from the class to the form (/backgroundworker)
...
I want to get alive or dead ip addresses from a big lan. but it takes so many times. I decided to use backgroundworker here is my code:
try
{
this.Status.Text = "Collecting Information...";
if(this.TxtWorkGroup.Text.Trim() == "")
{
MessageBox.Show("The Work Group name Should Not be Empty");
return;
}
...
Being new to using threads etc in UI's, can I ask is the following simple design seem OK. Refer to diagram image at link here
In particular:
a) use of backgroundworker & backgroundworker ProgressChanged to have the aggregator work on a separate thread. So I would need a custom class/type that had all the data I'd need to pass back fro...
How should I check for a CancellationPending within a BackgroundWorker DoWork method, when within this method I call off to a Pcap.Net packet capture routine, which responses via a callback. The two options I can think of is:
a) write a loop at the bottom of the DoWork method to continually check for CancellationPending
b) put the che...
I've got a c# windows form app I threw together. It's fairly simple:\
inputs:
text string
source folder path
destination folder path
integer count
The app searches through text files in the source folder for the entered text string; if it finds the string then it copies that file and an image file with the same name to the destin...
Hi,
I am using a BackgroundWorker thread to do some work outside of the GUI thread in Silverlight 4. I would like to update widgets in the GUI context from the background thread, but have read warnings about doing so from Microsoft documentation. I understand that communicating from one thread to another throws an exception as only th...
I have built a WebRequest in a WPF application into a background worker, but it is hanging if the website does not return a 404 error. There is a timeout, and found that some people have also had the same problem with the timeout not working and making the WebRequest hang. I tried to implement the code recommended for fixing the hang whi...
Hi,
I created a WCF client service (a Windows service) in C# which starts a BackgroundWorker in the OnStart to do the core functionality in the background and leaving the main thread managing the service itself. Maybe this approach is overkill but it's working without problems on my dev machine.
If I try to run it on the client machine...
I have UI WPF application.
May by some one have any ideas why this code is not working?
Case 1:
BackgroundWorker worker = new BackgroundWorker();
worker.DoWork += delegate
{
//some logic
};
worker.RunWorkerAsync();
In that case i am getting exception
The calling thread cannot access this object because a different thread owns i...
I am using starling as a queue server in my rails application. so each time i want to call worker method, I have to start starling and workling client from console.
Is there a way where as soon as the passenger is started my workling and starling both get auto started Or preciously when i will call the worker method then only my worlin...
Edit: Got somewhere, I hope
Here is what I've got, but I'm not so sure about how I delegate my bcLoad.ReportProgress(i) to the object created (ie how to make the delegate so it can be passed). I've created the object events which work sort of(I can call my object method and I can see a change triggered when reading in lines). I know w...
Hi All,
I am working on a C# windows application. This application is mainly related to sockets.
I have a class called tcpsocket, which handles all socket level functionality of sending, receiving data, etc. A controller class calls this tcpsocket. In addition, it does all other work of logging data to a file and updating GUI. I though...
Bit of a long shot, but is there a way in ASP.NET to dynamically get the website's URL (http://www.example.com) when there is no HttpContext.Current available.
There is no HttpContext because the code is running in a background thread* (but under the ASP.NET AppDomain). I have a background process that sends emails out every evening, an...
I am trying to use a background worker in order to retrieve a large amount of data from the database without stalling the main thread. This seems to work well, except that when it comes to update the UI, the update freezes the screen. Relevant code as follows:
private void bw_RunWorkerCompleted(object sender, RunWorkerCompletedEve...
My problem is that when I run the following it will say that the bash script has finishes successfully. But it doesnt wait for the script to finish, if it quits to early it will move a file that it needs. So what am I doing wrong that it wont wait for the background process to finish to move the files?
my $pid = fork();
if($pid == -...
Hi
the detail of my action is i have a winform which contains only progress bar which i made to do some calculations and stored the final value in db.for this i used progress bar and backgroundworker thread.
i am doing all calculation in backgroundworker thread event doWork event.
When backgroundworker is finish it calls RunWorkerComple...
Some sample code:
var psi = new ProcessStartInfo();
psi.FileName = "path to update.exe";
psi.Arguments = "arguments for update.exe";
psi.Verb = "runas";
var process = new Process();
process.StartInfo = psi;
process.Start();
process.WaitForExit();
Ref: 0xA3.
Programmatically in code what type of objects if possible could you pass ...
Lets say I have a class that is supposed to generate some ID (for example GUID) for me. Now unfortunately the ID generation is a somewhat long process and if I need a hundred of those I run into a problem of significant slowdowns. In order to avoid those, I keep a queue of pre-generated ID, and when this queue starts to run down on them ...
I'm using a BackgroundWorker to do some work. Part of that work involves showing a form. That form has some controls that are set as drag & drop targets.
I know that the BackgroundWorker uses the ThreadPool to run, and that threads from the thread pool use the MTA threading model. I also know (thanks to this question) that when you have...
I'm writing a WPF app using an MVVM approach. In my ViewModel, I have an ObservableCollection. Periodically, my app needs to check for new messages, and, if there are any, it needs to add them to the ObservableCollection.
If I try to add to the ObservableCollection in the DoWork, it doesn't work because of thread synchronization issue...