public void DownloadMissingFiles(ArrayList FilePaths) { Thread t = new Thread(() => isCompleted()); //Thread to check if all downloads are completed t.Start(); foreach (var MissingFile in FilePaths) //Start Asynchronous downloads. Can be changed to DL file when the one before is done, this would fix the Progressbar issue { try { ReadyForNextFile = false; Console.WriteLine("Missing File: " + MissingFile); DownloadFile(DownloadHost + MissingFile, MissingFile.ToString()); while (!ReadyForNextFile) { Thread.Sleep(100); } } catch (Exception ex) { MessageBox.Show("Error downloading " + MissingFile + " Error Message:\n" + ex); } } }
public void DownloadMissingFiles(ArrayList FilePaths) { foreach (var MissingFile in FilePaths) { DownloadFile(MissingFile.ToString()); //DownloadFile method might have to be edited for this } }
private void RemoveFile(MissingFile file) { Dispatcher.Invoke(() => { lock (_displayFiles) { _displayFiles.Remove(file); } }); }
private void AddEvent(MissingFile missingFile, SearchEvent searchEvent) { Dispatcher.Invoke(() => { lock (_displayFiles) { if (missingFile.Lookups == null) { missingFile.Lookups = new ObservableCollection <SearchEvent>(); } missingFile.Lookups.Insert(0, searchEvent); } }); }
private void DisplayFile(MissingFile file) { Dispatcher.Invoke(() => { lock (_displayFiles) { _displayFiles.Insert(0, file); while (_displayFiles.Count >= MaxDisplayedEntries) { _displayFiles.RemoveAt(MaxDisplayedEntries - 1); } } }); }