/// <summary> /// Ran by the thread to perform the request. /// </summary> public void Run() { if (this.param.Count > 0) { BotUtil.POSTPage(new Uri(this.url), this.param); } else { BotUtil.LoadPage(new Uri(url)); } }
/// <summary> /// Perform a post. /// </summary> /// <param name="service">The URL to post to.</param> /// <param name="stream">The stream to post.</param> public void PerformURLPOST(string service, Stream stream) { try { String contents = BotUtil.POSTPage(new Uri(service), stream); HandleResponse(contents); } catch (IOException e) { throw new EncogCloudError(e); } }
/// <summary> /// Perform a POST to the cloud. /// </summary> /// <param name="async">True if this request should be asynchronous.</param> /// <param name="service">The service.</param> /// <param name="args">The POST arguments.</param> public void PerformURLPOST(bool async, String service, IDictionary <String, String> args) { try { if (async) { AsynchronousCloudRequest request = new AsynchronousCloudRequest( service, args); Thread t = new Thread(new ThreadStart(request.Run)); t.Start(); } else { String contents = BotUtil.POSTPage(new Uri(service), args); HandleResponse(contents); } } catch (IOException e) { throw new EncogCloudError(e); } }