public void BackupSync(CloudBlobContainer container, string blobName, string version) { Copy(container, blobName, NumberOfCopies); var source = container.GetBlobReference(blobName); var target = container.GetBlobReference(blobName + VersionPrefix + version); DeleteOldAsyncState state = new DeleteOldAsyncState() { Container = container, BlobName = blobName, Target = target, Total = 5 }; target.BeginCopyFromBlob(source, DeleteOldAsyncCompletedCallback, state); }
private void DeleteOldAsyncCompletedCallback(IAsyncResult result) { DeleteOldAsyncState state = (DeleteOldAsyncState)result.AsyncState; try { state.Target.EndCopyFromBlob(result); } catch { } try { DeleteOld(state.Container, state.BlobName, state.Total); } catch { } }