コード例 #1
0
        /// <summary>
        /// Asynchronously downloads an xml file from the specified url
        /// </summary>
        /// <param name="url"></param>
        /// <param name="callback">A <see cref="DownloadXmlCompletedCallback"/> to be invoked when the request is completed</param>
        /// <param name="userState">A state object to be returned to the callback</param>
        /// <returns></returns>
        public object DownloadXmlAsync(string url, HttpPostData postData, DownloadXmlCompletedCallback callback, object userState)
        {
            string urlValidationError;
            if (!IsValidURL(url, out urlValidationError))
            {
                throw new ArgumentException(urlValidationError);
            }

            XmlRequestAsyncState state = new XmlRequestAsyncState(callback, DownloadXmlAsyncCompleted, userState);
            HttpWebServiceRequest request = GetRequest();
            request.GetResponseAsync(url, new MemoryStream(), XML_ACCEPT, postData, state);
            return request;
        }
コード例 #2
0
        /// <summary>
        /// Asynchronously downloads an xml file from the specified url
        /// </summary>
        /// <param name="url"></param>
        /// <param name="callback">A <see cref="DownloadXmlCompletedCallback"/> to be invoked when the request is completed</param>
        /// <param name="userState">A state object to be returned to the callback</param>
        /// <returns></returns>
        public object DownloadXmlAsync(string url, HttpPostData postData, DownloadXmlCompletedCallback callback, object userState)
        {
            string urlValidationError;

            if (!IsValidURL(url, out urlValidationError))
            {
                throw new ArgumentException(urlValidationError);
            }

            XmlRequestAsyncState  state   = new XmlRequestAsyncState(callback, DownloadXmlAsyncCompleted, userState);
            HttpWebServiceRequest request = GetRequest();

            request.GetResponseAsync(url, new MemoryStream(), XML_ACCEPT, postData, state);
            return(request);
        }
コード例 #3
0
 public XmlRequestAsyncState(DownloadXmlCompletedCallback callback, WebRequestAsyncCallback webRequestCallback, object userState)
     : base(webRequestCallback)
 {
     _downloadXmlCompleted = callback;
     _userState            = userState;
 }
コード例 #4
0
 public XmlRequestAsyncState(DownloadXmlCompletedCallback callback, WebRequestAsyncCallback webRequestCallback, object userState)
     : base(webRequestCallback)
 {
     _downloadXmlCompleted = callback;
     _userState = userState;
 }