private async Task <bool> RunSequentiallyAsync(IDataStore fileInfo, Func <IDataStore, Task <bool> > preparation) { bool ok = false; await _progress.EnterSingleThread(); try { if (_progress.Cancel) { _eventArgs.Status = new FileOperationContext(fileInfo.FullName, ErrorStatus.Canceled); return(ok); } ok = await preparation(fileInfo); if (_eventArgs.Status.ErrorStatus == ErrorStatus.Canceled) { _progress.Cancel = true; } } finally { _progress.LeaveSingleThread(); } return(ok); }
public void LeaveSingleThread() { if (!_isSingleThread) { return; } _progress.LeaveSingleThread(); _isSingleThread = false; }
public void LeaveSingleThread() { _progress.LeaveSingleThread(); }