public void RunInBackground() { if (_cancellationTokenSource == null) { _cancellationTokenSource = new CancellationTokenSource(); } AsyncTaskDispose(); _asyncTask = new CustomAsyncTask(this, _cancellationTokenSource.Token); _asyncTask.Execute(DocumentTaskType); }
private void AsyncTaskDispose() { _asyncTask?.Dispose(); _asyncTask = null; }