Encog.Cloud.CloudRequest.PerformURLGET C# (CSharp) Method

PerformURLGET() public method

Perform a GET request.
public PerformURLGET ( bool async, String url ) : void
async bool True if this request should be asynchronous.
url String The URL.
return void
        public void PerformURLGET(bool async, String url)
        {
            try
            {
                if (async)
                {
                    AsynchronousCloudRequest request = new AsynchronousCloudRequest(url);
                    Thread t = new Thread(new ThreadStart(request.Run));
                    t.Start();
                }
                else
                {
                    String contents = BotUtil.LoadPage(new Uri(url));
                    HandleResponse(contents);
                }
            }
            catch (IOException e)
            {
                throw new EncogCloudError(e);
            }
        }

Usage Example

Ejemplo n.º 1
0
        /// <summary>
        /// Validate the session.
        /// </summary>
        /// <param name="failOnError">True if an exception should be thrown on error.</param>
        public void ValidateSession(bool failOnError)
        {
            int max;

            if (failOnError)
            {
                max = 1;
            }
            else
            {
                max = 5;
            }

            for (int i = 0; i < max; i++)
            {
                CloudRequest request = new CloudRequest();
                request.PerformURLGET(false, this.session);
                if ("success".Equals(request.Status))
                {
                    return;
                }
            }

            if (failOnError)
            {
                throw new EncogCloudError("Connection lost");
            }
        }
All Usage Examples Of Encog.Cloud.CloudRequest::PerformURLGET