private void OnWindowClosing(object sender, CancelEventArgs e) { foreach (var t in _handles) { CustomThreadPool.CancelUserTask(t); } _pool.Dispose(); _accumulator.Dispose(); }
private void BRemove_Click(object sender, RoutedEventArgs e) { if (_handles.Count == 0) { return; } var thread = _handles.First(); CustomThreadPool.CancelUserTask(thread); _handles.Remove(thread); LThreads.Content = $"Thread count: {_handles.Count}"; }
private void StopClick(object sender, MouseButtonEventArgs e) { CustomThreadPool.Suspend = true; for (var i = _complete / Step + 1; i < _currentTask.Count; i++) { if (_currentTask[i].State != TaskState.NotStarted) { continue; } CustomThreadPool.CancelUserTask(_currentTask[i]); } CustomThreadPool.Suspend = false; var file = new FileInfo(LDestination.Content.ToString()); lock (_destFile) { file.Delete(); } PbProgress.Value = PbProgress.Maximum; }