private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) { lock (m_lock) m_thread = System.Threading.Thread.CurrentThread; try { object[] args = (object[])e.Argument; DuplicatiRunner r = new DuplicatiRunner(); IList<string> sourceFolders = r.ListSourceFolders((Datamodel.Schedule)args[0], (DateTime)args[1]); if (r.IsAborted) e.Cancel = true; else { r = new DuplicatiRunner(); List<KeyValuePair<Library.Main.RSync.RSyncDir.PatchFileType, string>> files = r.ListActualFiles((Datamodel.Schedule)args[0], (DateTime)args[1]); e.Result = new KeyValuePair<IList<string>, List<KeyValuePair<Library.Main.RSync.RSyncDir.PatchFileType, string>>>(sourceFolders, files); if (r.IsAborted) e.Cancel = true; } } catch (System.Threading.ThreadAbortException) { System.Threading.Thread.ResetAbort(); e.Cancel = true; } finally { lock (m_lock) m_thread = null; } }
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) { lock (m_lock) m_thread = System.Threading.Thread.CurrentThread; try { object[] args = (object[])e.Argument; DuplicatiRunner r = new DuplicatiRunner(); IList <string> sourceFolders = r.ListSourceFolders((Datamodel.Schedule)args[0], (DateTime)args[1]); if (r.IsAborted) { e.Cancel = true; } else { r = new DuplicatiRunner(); List <KeyValuePair <Library.Main.RSync.RSyncDir.PatchFileType, string> > files = r.ListActualFiles((Datamodel.Schedule)args[0], (DateTime)args[1]); e.Result = new KeyValuePair <IList <string>, List <KeyValuePair <Library.Main.RSync.RSyncDir.PatchFileType, string> > >(sourceFolders, files); if (r.IsAborted) { e.Cancel = true; } } } catch (System.Threading.ThreadAbortException) { System.Threading.Thread.ResetAbort(); e.Cancel = true; } finally { lock (m_lock) m_thread = null; } }