I have a backgroundworker.. In the backgroundworker_doWork I would like to check if a file exists or not.. if doesn't then i wait for the file to be create and once its create then carry on with the work its suppose to do
I want do something like this.. but i just figure out how to do it.. im new to this :
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
{
if(File.Exists(filename)){
//.. code to do my work ...
}
else{
//..Wait for the file to be create...
}
//... end of backgroundworker
}
Thanks in advance
You can use a FileSystemWatcher
to get an event when the file is created.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With