コード例 #1
0
        public HttpPostAction(HttpClientWrapper parent, String url, Dictionary <String, String> data)
        {
            this.parent    = parent;
            this.url       = url;
            this.response  = "";
            this.has_error = false;
            //init post data
            StringBuilder sb = new StringBuilder();

            foreach (KeyValuePair <String, String> item in data)
            {
                sb.AppendFormat("{0}={1}", item.Key, HttpUtility.UrlEncode(item.Value));
                sb.Append("&");
            }
            this.data = sb.ToString().Trim(new char[] { ' ', '&' });
        }
コード例 #2
0
        public void Run()
        {
            try {
                using (WebClient client = new WebClient()) {
                    this.response = client.DownloadString(this.url);
                }
            }
            catch (Exception) {
                this.response  = "{\"status\":\"failure\",\"message\":\"Http client error check connection\"}";
                this.has_error = true;
            }

            if (HttpClientWrapper.getNotificationReceiver() != null)
            {
                LogServiceResponse formated_response = this.parent.unpackData(this.response);
                HttpClientWrapper.getNotificationReceiver().LoggingClientCompleted(formated_response, this.has_error);
            }
        }
コード例 #3
0
 public static void Initialise(INotifiable notification_receiver, bool is_async)
 {
     HttpClientWrapper.setParams(notification_receiver, is_async);
 }