コード例 #1
0
        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);
        }
コード例 #2
0
 public void LeaveSingleThread()
 {
     if (!_isSingleThread)
     {
         return;
     }
     _progress.LeaveSingleThread();
     _isSingleThread = false;
 }
コード例 #3
0
 public void LeaveSingleThread()
 {
     _progress.LeaveSingleThread();
 }