Exemplo n.º 1
0
        /// <summary>
        /// Asynchronous method to handle the completion of the file upload process.
        /// </summary>
        /// <param name="result">Contains the DC_ServerResponse that the server sent.</param>
        private void postFileStreamResult(IAsyncResult result)
        {
            PostFileStreamDelegate  del             = result.AsyncState as PostFileStreamDelegate;
            ServerConnectorResponse server_response = del.EndInvoke(result);

            if (!server_response.canceled)
            {
                upload_completed.Invoke(server_response);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Begin upload of a file to the server.
        /// </summary>
        /// <param name="file_location">Local file location on the client computer.</param>
        ///
        public void uploadFile(string file_location)
        {
            RequestQuery queue_query = new RequestQuery()
            {
                upload        = true,
                file_location = file_location
            };

            if (requestAlowed(queue_query) == false)
            {
                return;
            }

            FileStream             fs   = new FileStream(file_location, FileMode.Open, FileAccess.Read, FileShare.Read);
            Uri                    uri  = buildUri("Files:upload");
            PostFileStreamDelegate post = new PostFileStreamDelegate(postFileStream);

            post.BeginInvoke(uri, fs, new AsyncCallback(postFileStreamResult), post);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Begin upload of a file to the server.
        /// </summary>
        /// <param name="file_location">Local file location on the client computer.</param>
        /// 
        public void uploadFile(string file_location)
        {
            RequestQuery queue_query = new RequestQuery() {
                upload = true,
                file_location = file_location
            };

            if(requestAlowed(queue_query) == false)
                return;

            FileStream fs = new FileStream(file_location, FileMode.Open, FileAccess.Read, FileShare.Read);
            Uri uri = buildUri("Files:upload");
            PostFileStreamDelegate post = new PostFileStreamDelegate(postFileStream);
            post.BeginInvoke(uri, fs, new AsyncCallback(postFileStreamResult), post);
        }