Beispiel #1
0
        public void Stop(bool immediate)
        {
            _Dead = true;

            if (immediate)
            {
                _Running = false;
            }

            if (_Client.IsBusy)
            {
                _Client.CancelAsync();
            }
        }
Beispiel #2
0
        public void StartRequest(byte[] postData, string contentType)
        {
            _PostData    = postData;
            _ContentType = contentType;

            if (_Client.IsBusy)
            {
                _Client.CancelAsync();
            }

            _Client.Headers.Clear();

            // Proxy
            if (Proxy != null)
            {
                _Client.Proxy = Proxy;
            }

            // Content-Type
            if (!String.IsNullOrEmpty(contentType))
            {
                _Client.Headers.Add(HttpRequestHeader.ContentType, contentType);
            }
            else
            {
                _Client.Headers.Add(HttpRequestHeader.ContentType, "application/xml");
            }

            if (postData == null)
            {
                _Client.DownloadStringAsync(_Client.Location);
            }
            else
            {
                _Client.UploadDataAsync(_Client.Location, postData);
            }
        }