public void Load() { //LoadCompleted = false; //LoadAsync(); //while ( !LoadCompleted ) { // Application.DoEvents(); //} lock ( BookList ) { BookList.AddRange(_getSubDirs(_pathname, null, 0, 0)); } }
private void _worker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { if (!e.Cancelled) { lock ( BookList ) { BookList.AddRange((TBookCollection)e.Result); } if (_assignedProgressBar != null) { _assignedProgressBar.Value = _assignedProgressBar.Maximum; } } if (onLoadCompleted != null) { onLoadCompleted(this, EventArgs.Empty); } LoadCompleted = true; }