public void EnqueueOperation(BaseDriveOperation operation) { switch (operation.Type) { case OperationType.FileTable: _highPriorityOperations.Enqueue(operation); break; case OperationType.Read: case OperationType.Write: _lowPriorityOperations.Enqueue(operation); break; } lock (_driveAccessLock) DriveAccess = DriveAccess.ContinueWith(t => runOperations()).Unwrap(); }
private async Task runOperation(BaseDriveOperation operation) { var task = operation.Run(_drive); await task; }