Beispiel #1
0
        public NetworkResponse EndGetResponse(IAsyncResult result)
        {
            NetworkResponse resp;

            if (this.m_requestHandle == 0)
            {
                resp = null;
            }
            else
            {
                try
                {
                    NetworkAsyncResult.WaitOnCompletion(result);
                }
                catch (WebException ex)
                {
                }
                string response = "";
                if (NetworkRequest.GetResponseNative(this.m_requestHandle, out response) < 0)
                {
                    resp = null;
                }
                else
                {
                    resp = new NetworkResponse(response);
                }
            }
            return(resp);
        }
Beispiel #2
0
        private IAsyncResult BeginGetResponse()
        {
            IAsyncResult result;

            if (this.m_requestHandle == 0)
            {
                result = null;
            }
            else
            {
                if (this.m_asyncResult == null)
                {
                    this.m_asyncResult = new NetworkAsyncResult(this.m_responseCallback, this.m_callbackArg);
                }
                if (this.m_thread == null)
                {
                    NetworkRequest.RegisterThreadNative();
                    try
                    {
                        this.m_thread = new Thread(delegate()
                        {
                            string text = "";
                            if (NetworkRequest.GetResponseNative(this.m_requestHandle, out text) < 0)
                            {
                            }
                            if (this.m_asyncResult != null)
                            {
                                this.m_asyncResult.Complete();
                            }
                        });
                    }
                    finally
                    {
                        NetworkRequest.UnregisterThreadNative();
                    }
                    this.m_thread.Start();
                }
                result = this.m_asyncResult;
            }
            return(result);
        }
Beispiel #3
0
        public NetworkResponse GetResponse()
        {
            NetworkResponse resp;

            if (this.m_requestHandle == 0)
            {
                resp = null;
            }
            else
            {
                string response = "";
                if (NetworkRequest.GetResponseNative(this.m_requestHandle, out response) < 0)
                {
                    resp = null;
                }
                else
                {
                    resp = new NetworkResponse(response);
                }
            }
            return(resp);
        }