public void CallNetwork(string URL, Action <string, Exception> CallBack)
        {
            CallBackWrapper wrapper = new CallBackWrapper(CallBack);
            HttpWebRequest  wr      = (HttpWebRequest)WebRequest.Create(URL);

            wr.Method          = HttpMethod.Post;
            wr.ContentType     = HttpContentType.FormUrlEncoded;
            wr.ContentLength   = 397;
            wrapper.WebRequest = wr;
            wr.BeginGetRequestStream(requestStreamCallback, wrapper);
            // allDone.WaitOne();
        }
        private void requestStreamCallback(IAsyncResult asynchronousResult)
        {
            CallBackWrapper wrapper    = (CallBackWrapper)asynchronousResult.AsyncState;
            HttpWebRequest  request    = wrapper.WebRequest;
            Stream          postStream = request.EndGetRequestStream(asynchronousResult);

            string postData = request_body_used_for_each_api_call;

            byte[] byteArray = Encoding.UTF8.GetBytes(postData);
            postStream.Write(byteArray, 0, postData.Length);
            postStream.Close();
            wrapper.WebRequest = request;
            request.BeginGetResponse(responseCallback, wrapper);
        }
        private void responseCallback(IAsyncResult asynchronousResult)
        {
            CallBackWrapper wrapper        = (CallBackWrapper)asynchronousResult.AsyncState;
            HttpWebRequest  request        = wrapper.WebRequest;
            HttpWebResponse response       = (HttpWebResponse)request.EndGetResponse(asynchronousResult);
            Stream          streamResponse = response.GetResponseStream();
            StreamReader    streamRead     = new StreamReader(streamResponse);
            string          responseText   = streamRead.ReadToEnd();

            wrapper.CallBack(responseText, null);

            streamResponse.Close();
            streamRead.Close();
            response.Close();
            // allDone.Set();
        }