Beispiel #1
0
        public byte[] GetData(string Url)
        {
            WebClientExt client = GetWebClient();
            var          result = client.DownloadData(Url);

            return(result);
        }
Beispiel #2
0
        public void PostAsync(string Url, string Data, AjaxCallBack callback = null)
        {
            WebClientExt client = GetWebClient();

            client.UploadStringCompleted += Client_UploadStringCompleted;
            client.UploadStringAsync(new Uri(Url), "POST", Data, callback);
        }
Beispiel #3
0
        public void GetAsync(string Url, AjaxCallBack callback = null)
        {
            WebClientExt client = GetWebClient();

            client.DownloadStringCompleted += Client_DownloadStringCompleted;;
            client.DownloadStringAsync(new Uri(Url), callback);
        }
Beispiel #4
0
        public string Get(string Url)
        {
            WebClientExt client = GetWebClient();
            string       result = client.DownloadString(Url);

            return(result);
        }
Beispiel #5
0
        public void PostDataAsync(string Url, string Data, AjaxCallBack callback = null)
        {
            WebClientExt client = GetWebClient();

            client.UploadDataCompleted += Client_UploadDataCompleted;
            client.UploadDataAsync(new Uri(Url), "POST", Encoder.GetBytes(Data), callback);
        }
Beispiel #6
0
        public string Post(string Url, string Data)
        {
            WebClientExt client = GetWebClient();

            string result = client.UploadString(Url, Data);

            return(result);
        }
Beispiel #7
0
        public byte[] PostData(string Url, string Data)
        {
            WebClientExt client = GetWebClient();

            var result = client.UploadData(Url, Encoder.GetBytes(Data));

            return(result);
        }
Beispiel #8
0
        public void GetDataAsync(string Url, FileDownHandle callback)
        {
            WebClientExt client = GetWebClient();

            client.DownloadDataCompleted += (object sender, DownloadDataCompletedEventArgs e) =>
            {
                callback?.Invoke(e.Result);
            };
            client.DownloadDataAsync(new Uri(Url));
        }
Beispiel #9
0
        private void Client_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
        {
            WebClientExt client = sender as WebClientExt;

            if (e.UserState != null)
            {
                var callback = e.UserState as AjaxCallBack;
                callback(e.Result);
            }
        }
Beispiel #10
0
        private void Client_UploadDataCompleted(object sender, UploadDataCompletedEventArgs e)
        {
            WebClientExt client = sender as WebClientExt;

            if (e.UserState != null)
            {
                var    callback = e.UserState as AjaxCallBack;
                string result   = Encoder.GetString(e.Result);
                callback(result);
            }
        }
Beispiel #11
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        private WebClientExt GetWebClient()
        {
            WebClientExt client = new WebClientExt();

            client.CookieContainer = Cookies;
            client.Timeout         = Timeout;
            client.Encoding        = Encoder;
            Headers.Set(HttpRequestHeader.Referer, Referer);
            client.Headers = Headers;


            return(client);
        }