Exemplo n.º 1
0
        /// <summary>
        /// Announce completion of PUT operation
        /// </summary>
        /// <param name="result"></param>
        private void PutOperationCompleteCallback(IAsyncResult result)
        {
            if (blob != null)
            {
                bool propFlag = false;
                switch (Path.GetExtension(blob.Uri.AbsoluteUri))
                {
                case ".js":
                case ".html":
                    blob.Properties.ContentType = "text/html";
                    propFlag = true;
                    break;

                case ".css":
                    blob.Properties.ContentType = "text/css";
                    propFlag = true;
                    break;

                case ".txt":
                    blob.Properties.ContentType = "text/text";
                    propFlag = true;
                    break;

                case ".png":
                    blob.Properties.ContentType = "image/png";
                    propFlag = true;
                    break;
                    //
                }
                if (propFlag)
                {
                    blob.SetProperties();
                }
            }

            var o = (Uri)result.AsyncState;

            if (StorageProviderOperationCompleted == null)
            {
                return;
            }
            var a = new StorageProviderEventArgs
            {
                Operation = StorageOperation.Put, Result = StorageOperationResult.Created
            };

            // Raise the event

            //blob.Properties.ContentType = "text/html";
            //blob.BeginSetProperties(ChangeOptionsOperationCompleteCallback, null);



            StorageProviderOperationCompleted(o, a);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Announce completion of a Delete operation.
        /// </summary>
        /// <param name="result"></param>
        private void DeleteOperationCompleteCallback(IAsyncResult result)
        {
            var o = (Uri)result.AsyncState;

            if (StorageProviderOperationCompleted == null)
            {
                return;
            }
            var a = new StorageProviderEventArgs
            {
                Operation = StorageOperation.Delete, Result = StorageOperationResult.Deleted
            };

            // Raise the event
            StorageProviderOperationCompleted(o, a);
        }
        private void PutOperationCompleteCallback(IAsyncResult result)
        {
            var o = (Uri) result.AsyncState;
            if (StorageProviderOperationCompleted == null) return;
            var a = new StorageProviderEventArgs
                        {Operation = StorageOperation.Put, Result = StorageOperationResult.Created};

            StorageProviderOperationCompleted(o, a);
        }
        /// <summary>
        /// Announce completion of MOVE operation
        /// </summary>
        /// <param name="result"></param>
        private void MoveOperationCompleteCallback(IAsyncResult result) {
            List<Uri> uris = (List<Uri>)result.AsyncState;
            ICloudBlob originalBlob = _blobClient.GetBlobReferenceFromServer(uris[0]);
            AsyncCallback callback = DeleteOperationCompleteCallback;
            originalBlob.BeginDeleteIfExists(callback, uris[0]);

            if (StorageProviderOperationCompleted == null) return;
            var a = new StorageProviderEventArgs { Operation = StorageOperation.Put, Result = StorageOperationResult.Created };

            // Raise the event
            StorageProviderOperationCompleted(uris[1], a);

        }
        /// <summary>
        /// Announce completion of a Delete operation.
        /// </summary>
        /// <param name="result"></param>
        private void DeleteOperationCompleteCallback(IAsyncResult result) {
            var o = (Uri)result.AsyncState;

            if (StorageProviderOperationCompleted == null) return;
            var a = new StorageProviderEventArgs { Operation = StorageOperation.Delete, Result = StorageOperationResult.Deleted };
            // Raise the event
            StorageProviderOperationCompleted(o, a);
        }
        /// <summary>
        /// Announce completion of PUT operation
        /// </summary>
        /// <param name="result"></param>
        private void PutOperationCompleteCallback(IAsyncResult result)
        {
            if (blob != null)
            {

                bool propFlag = false;
                switch (Path.GetExtension(blob.Uri.AbsoluteUri))
                {
                    case ".js":
                    case ".html":
                        blob.Properties.ContentType = "text/html";
                        propFlag = true;
                        break;
                    case ".css":
                        blob.Properties.ContentType = "text/css";
                        propFlag = true;
                        break;
                    case ".txt":
                        blob.Properties.ContentType = "text/text";
                        propFlag = true;
                        break;
                    case ".png":
                        blob.Properties.ContentType = "image/png";
                        propFlag = true;
                        break;
                    //
                }
                if (propFlag) blob.SetProperties();

            }

            var o = (Uri) result.AsyncState;

            if (StorageProviderOperationCompleted == null) return;
            var a = new StorageProviderEventArgs
                        {Operation = StorageOperation.Put, Result = StorageOperationResult.Created};

            // Raise the event

            //blob.Properties.ContentType = "text/html";
            //blob.BeginSetProperties(ChangeOptionsOperationCompleteCallback, null);

            StorageProviderOperationCompleted(o, a);
        }