/// <inheritdoc /> protected override void StopFunction() { _stop.Set(); JobThread.Join(); foreach (var worker in _workers) { worker.Join(); } _listener.Stop(); }
private void OnProcessJobs() { SaveConfig(); if (_jobs.Count == 0) { LogWarning("No job in the list."); return; } if (!IsMEncoderPathValid(Config.MEncoderFilePath)) { return; } if (_jobs.Count != _jobsListView.Items.Count) { LogError("The GUI and application job list count don't match. You should restart the application."); return; } Gui_OnJobStart(); _jobsListView.Background = _jobsListViewBackground; if (JobThread != null) { JobThread.Join(); } // Create a copy to be used only by the thread. var data = new JobsProcessThreadData(); // ... JobThread = new Thread(JobsThread); JobThread.Start(data); }
private void AddJobs(List <string> filePaths, List <string> folderPaths) { if (filePaths.Count == 0 && folderPaths.Count == 0) { return; } Gui_OnJobStart(); _jobsListView.Background = _jobsListViewBackground; if (JobThread != null) { JobThread.Join(); } // Create a copy to be used only by the thread. var data = new JobAddThreadData(); data.FilePaths.AddRange(filePaths); data.FolderPaths.AddRange(folderPaths); JobThread = new Thread(JobAddThread); JobThread.Start(data); }