Tuesday, May 8, 2012

Calling ShowDialog in BackgroundWorker

My background worker is doing a sync task, adding new files, removing old ones etc.



In my background worker code I want to show a custom form to user telling him what will be deleted and what will be added if he continues . with YES/NO buttons to get his feedback.



I wondering if it is ok to do soemthing liek this in background worker's doWork method ?
if it is not safe how should I do it



Please advise..



private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
{
MyForm f = new MyForm();
f.FilesToAddDelete(..);
DialogResult result = f.ShowDialog();
if(No...)
return;
else
//keep working...
}




No comments:

Post a Comment