Reputation: 1114
Can I open Dialog from BackgroundWorker and pause it until user decides?
MyWorker = new System.ComponentModel.BackgroundWorker();
MyWorker.DoWork += new System.ComponentModel.DoWorkEventHandler(CopyWorker_DoWork);
MyWorker.RunWorkerAsync();
private void MyWorker_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
{
int i=0;
while ((i) < collection.Count())
{
cListEntry item = collection[i];
if (item.conflicted ==true) {
Dispatcher.BeginInvoke(new Action(() =>
{
var dialog = new WindowConflict();
//Open dialog and wait for user action
if (dialog.ShowDialog() == true)
{
item.level = dialog.Response;
}
Upvotes: 0
Views: 406
Reputation: 36
You should use invoke instead of begininvoke, begininvoke allows the task to continue running but you want it to wait.
Upvotes: 1