Exemplo n.º 1
0
 /// <inheritdoc />
 protected override void StopFunction()
 {
     _stop.Set();
     JobThread.Join();
     foreach (var worker in _workers)
     {
         worker.Join();
     }
     _listener.Stop();
 }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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);
        }