public void Cancel() { Canceled.Reset(); _backgroundProcessor.CancelAsync(); Canceled.WaitOne(); Done.Reset(); Canceled.Reset(); }
public void RunAsync(Config config) { Done.Reset(); Canceled.Reset(); if (_processor.SamplesCount < 2) { throw new InvalidOperationException(string.Format("Minimum two samples are required; {0} is given.", _processor.SamplesCount)); } if (_backgroundProcessor.IsBusy) { Cancel(); } _backgroundProcessor.RunWorkerAsync(config); }