private void ResetTask() { _taskWorkItem = null; _task = null; }
public void StartTask(Action task) { if (_taskWorkItem != null) throw new InvalidOperationException("Cannot change background task while it's running"); _task = task; _taskWorkItem = AbortableThreadPool.QueueUserWorkItem(RunTask, new TaskStatus()); }