protected virtual void worker_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e) { while (MainList.Count > 0) { IWork work = MainList.First.Value; if (!work.Initialize()) { work.OnFailed(); RunOnFailed(); return; } if (!work.Execute()) { work.OnFailed(); RunOnFailed(); return; } work.OnCompleted(); MainList.RemoveFirst(); } if (MainList.Count == 0) { RunOnCompleted(); } }