/// <summary> /// Sleep while suspended. /// </summary> private void sleepWhileSuspended() { if (syncWorker.CancellationPending) { //Sync was cancelled... throw new OperationCanceledException("Sync was cancelled by user."); } if (repo.Status == SyncStatus.Suspend) { repo.OnSyncSuspend(); while (repo.Status == SyncStatus.Suspend) { Logger.DebugFormat("Sync of {0} is suspend, next retry in {1}ms", repoinfo.Name, SYNC_SUSPEND_SLEEP_INTERVAL); System.Threading.Thread.Sleep(SYNC_SUSPEND_SLEEP_INTERVAL); if (syncWorker.CancellationPending) { //Sync was cancelled... repo.Resume(); repo.OnSyncResume(); throw new OperationCanceledException("Suspended sync was cancelled by user."); } } repo.OnSyncResume(); } }