Inheritance: AsyncData, IAsyncEntryData
        /// <summary>
        /// worker method for the resumable update
        /// </summary>
        /// <param name="data"></param>
        /// <param name="asyncOp"></param>
        /// <param name="completionMethodDelegate"></param>
        /// <returns></returns>
        private void AsyncUpdateWorker(AsyncResumableUploadData data, AsyncOperation asyncOp, SendOrPostCallback completionMethodDelegate)
        {
            try
            {
                if (data.Entry != null)
                {
                    using (var response = Update(data.Authentication, data.Entry, data))
                    {
                        HandleResponseStream(data, response.GetResponseStream(), -1);
                    }
                }
                else
                {
                    using (var response = Update(data.Authentication, data.UriToUse, data.DataStream, data.ContentType, data))
                    {
                        HandleResponseStream(data, response.GetResponseStream(), -1);
                    }
                }
            }
            catch (Exception e)
            {
                data.Exception = e;
            }

            this.CompletionMethodDelegate(data);
        }
        public void UpdateAsync(Authenticator authentication, AbstractEntry payload, object userData)
        {
            AsyncResumableUploadData data = new AsyncResumableUploadData(this,
                                                                         authentication,
                                                                         payload,
                                                                         HttpMethods.Put,
                                                                         this.ProgressReportDelegate,
                                                                         userData);
            WorkerResumableUploadHandler workerDelegate = new WorkerResumableUploadHandler(AsyncUpdateWorker);

            this.AsyncStarter(data, workerDelegate, userData);
        }
        public void InsertAsync(Authenticator authentication, AbstractEntry payload, object userData)
        {
            AsyncResumableUploadData data = new AsyncResumableUploadData(this,
                                                                         authentication,
                                                                         payload,
                                                                         HttpMethods.Post,
                                                                         this.ProgressReportDelegate,
                                                                         userData);

            data.UriToUse = GetResumableCreateUri(payload.Links);
            WorkerResumableUploadHandler workerDelegate = new WorkerResumableUploadHandler(AsyncInsertWorker);

            this.AsyncStarter(data, workerDelegate, userData);
        }
        public void ResumeAsync(Authenticator authentication, Uri resumeUri, String httpmethod, Stream payload, string contentType, object userData)
        {
            AsyncResumableUploadData data = new AsyncResumableUploadData(this,
                                                                         authentication,
                                                                         resumeUri,
                                                                         payload,
                                                                         contentType,
                                                                         null,
                                                                         httpmethod,
                                                                         this.ProgressReportDelegate,
                                                                         userData);
            WorkerResumableUploadHandler workerDelegate = new WorkerResumableUploadHandler(AsyncResumeWorker);

            this.AsyncStarter(data, workerDelegate, userData);
        }
        public void InsertAsync(Authenticator authentication, Uri resumableUploadUri, Stream payload, string contentType, string slug, object userData)
        {
            AsyncResumableUploadData data = new AsyncResumableUploadData(this,
                                                                         authentication,
                                                                         resumableUploadUri,
                                                                         payload,
                                                                         contentType,
                                                                         slug,
                                                                         HttpMethods.Post,
                                                                         this.ProgressReportDelegate,
                                                                         userData);
            WorkerResumableUploadHandler workerDelegate = new WorkerResumableUploadHandler(AsyncInsertWorker);

            this.AsyncStarter(data, workerDelegate, userData);
        }
        /// <summary>
        /// starts the async job
        /// </summary>
        /// <param name="data"></param>
        /// <param name="userData"></param>
        /// <param name="workerDelegate"></param>
        /// <returns></returns>
        private void AsyncStarter(AsyncResumableUploadData data, WorkerResumableUploadHandler workerDelegate, Object userData)
        {
            AsyncOperation asyncOp = AsyncOperationManager.CreateOperation(userData);

            data.Operation = asyncOp;

            AddUserDataToDictionary(userData, asyncOp);

            // Start the asynchronous operation.
            workerDelegate.BeginInvoke(
                data,
                asyncOp,
                this.CompletionMethodDelegate,
                null,
                null);
        }
        /// <summary>
        /// worker method for the the resumable insert
        /// </summary>
        /// <param name="data"></param>
        /// <param name="asyncOp"></param>
        /// <param name="completionMethodDelegate"></param>
        /// <returns></returns>
        private void AsyncInsertWorker(AsyncResumableUploadData data, AsyncOperation asyncOp, SendOrPostCallback completionMethodDelegate)
        {
            try {
                AbstractEntry abstractEntry = data.Entry as AbstractEntry;
                if (abstractEntry != null)
                {
                    using (var response = Insert(data.Authentication, abstractEntry, data)) {
                        HandleResponseStream(data, response.GetResponseStream(), -1, abstractEntry.Service);
                    }
                }
                else
                {
                    using (var response = Insert(data.Authentication, data.UriToUse, data.DataStream, data.ContentType, data.Slug, data)) {
                        HandleResponseStream(data, response.GetResponseStream(), -1, null);
                    }
                }
            } catch (Exception e) {
                data.Exception = e;
            }

            this.CompletionMethodDelegate(data);
        }
        /// <summary>
        /// starts the async job
        /// </summary>
        /// <param name="data"></param>
        /// <param name="userData"></param>
        /// <param name="workerDelegate"></param>
        /// <returns></returns>
        private void AsyncStarter(AsyncResumableUploadData data, WorkerResumableUploadHandler workerDelegate, Object userData) {
            AsyncOperation asyncOp = AsyncOperationManager.CreateOperation(userData);
            data.Operation = asyncOp;

            AddUserDataToDictionary(userData, asyncOp);

            // Start the asynchronous operation.
            workerDelegate.BeginInvoke(
                data,
                asyncOp,
                this.CompletionMethodDelegate,
                null,
                null);
        }
        /// <summary>
        /// worker method for the resumable update
        /// </summary>
        /// <param name="data"></param>
        /// <param name="asyncOp"></param>
        /// <param name="completionMethodDelegate"></param>
        /// <returns></returns>
        private void AsyncUpdateWorker(AsyncResumableUploadData data, AsyncOperation asyncOp, SendOrPostCallback completionMethodDelegate) {
            try {
                AbstractEntry abstractEntry = data.Entry as AbstractEntry;
                if (abstractEntry != null) {
                    using (var response = Update(data.Authentication, abstractEntry, data)) {
                        HandleResponseStream(data, response.GetResponseStream(), -1);
                    }
                } else {
                    using (var response = Update(data.Authentication, data.UriToUse, data.DataStream, data.ContentType, data)) {
                        HandleResponseStream(data, response.GetResponseStream(), -1);
                    }
                }
            } catch (Exception e) {
                data.Exception = e;
            }

            this.CompletionMethodDelegate(data);
        }
        /// <summary>
        /// worker method to handle the resume operation
        /// </summary>
        /// <param name="data"></param>
        /// <param name="asyncOp"></param>
        /// <param name="completionMethodDelegate"></param>
        /// <returns></returns>
        private void AsyncResumeWorker(AsyncResumableUploadData data, AsyncOperation asyncOp, SendOrPostCallback completionMethodDelegate) {
            try {
                using (var response = Resume(data.Authentication, data.UriToUse, data.HttpVerb, data.DataStream, data.ContentType, data)) {
                    HandleResponseStream(data, response.GetResponseStream(), -1);
                }
            } catch (Exception e) {
                data.Exception = e;
            }

            this.CompletionMethodDelegate(data);
        }
 public void ResumeAsync(Authenticator authentication, Uri resumeUri, String httpmethod, Stream payload, string contentType, object userData) {
     AsyncResumableUploadData data = new AsyncResumableUploadData(this,
         authentication,
         resumeUri,
         payload,
         contentType,
         null,
         httpmethod,
         this.ProgressReportDelegate,
         userData);
     WorkerResumableUploadHandler workerDelegate = new WorkerResumableUploadHandler(AsyncResumeWorker);
     this.AsyncStarter(data, workerDelegate, userData);
 }
 public void UpdateAsync(Authenticator authentication, AbstractEntry payload, object userData) {
     AsyncResumableUploadData data = new AsyncResumableUploadData(this,
         authentication,
         payload,
         HttpMethods.Put,
         this.ProgressReportDelegate,
         userData);
     WorkerResumableUploadHandler workerDelegate = new WorkerResumableUploadHandler(AsyncUpdateWorker);
     this.AsyncStarter(data, workerDelegate, userData);
 }
 public void InsertAsync(Authenticator authentication, Uri resumableUploadUri, Stream payload, string contentType, string slug, object userData) {
     AsyncResumableUploadData data = new AsyncResumableUploadData(this,
         authentication,
         resumableUploadUri,
         payload,
         contentType,
         slug,
         HttpMethods.Post,
         this.ProgressReportDelegate,
         userData);
     WorkerResumableUploadHandler workerDelegate = new WorkerResumableUploadHandler(AsyncInsertWorker);
     this.AsyncStarter(data, workerDelegate, userData);
 }
 public void InsertAsync(Authenticator authentication, AbstractEntry payload, object userData) {
     AsyncResumableUploadData data = new AsyncResumableUploadData(this,
         authentication,
         payload,
         HttpMethods.Post,
         this.ProgressReportDelegate,
         userData);
     data.UriToUse = GetResumableCreateUri(payload.Links);
     WorkerResumableUploadHandler workerDelegate = new WorkerResumableUploadHandler(AsyncInsertWorker);
     this.AsyncStarter(data, workerDelegate, userData);
 }