public CloudBlobUploader(Stream fileStream, Uri cloudBlobUri, IDictionary<string, string> metadata, BlobProperties blobProperties, IStorageCredentials credentials, Dispatcher dispatcher)
        {
            this.fileStream = fileStream;
            this.cloudBlobUri = cloudBlobUri;
            this.metadata = metadata;
            this.blobProperties = blobProperties;
            this.credentials = credentials;

            this.dataLength = this.fileStream.Length;
            this.dataSent = 0;

            this.dispatcher = dispatcher;

            // Upload the blob in smaller blocks if it's a "big" stream.
            this.useBlocks = (this.dataLength - this.dataSent) > ChunkSize;
        }
        internal static void AddBlobPropertiesHeaders(this WebHeaderCollection headers, BlobProperties blobProperties)
        {
            if ((headers != null) && (blobProperties != null))
            {
                if (!string.IsNullOrWhiteSpace(blobProperties.ContentType))
                    headers["x-ms-blob-content-type"] = blobProperties.ContentType;

                if (!string.IsNullOrWhiteSpace(blobProperties.ContentMD5))
                    headers["x-ms-blob-content-md5"] = blobProperties.ContentMD5;

                if (!string.IsNullOrWhiteSpace(blobProperties.ContentLanguage))
                    headers["x-ms-blob-content-language"] = blobProperties.ContentLanguage;

                if (!string.IsNullOrWhiteSpace(blobProperties.ContentEncoding))
                    headers["x-ms-blob-content-encoding"] = blobProperties.ContentEncoding;

                if (!string.IsNullOrWhiteSpace(blobProperties.CacheControl))
                    headers["x-ms-blob-cache-control"] = blobProperties.CacheControl;
            }
        }