PerformURLGET() публичный Метод

Perform a GET request.
public PerformURLGET ( bool async, String url ) : void
async bool True if this request should be asynchronous.
url String The URL.
Результат void
Пример #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");
            }
        }
Пример #2
0
        /// <summary>
        /// Logout of the specified session.
        /// </summary>
        public void Logout()
        {
            CloudRequest request = new CloudRequest();

            request.PerformURLGET(false, this.session + "logout");
            this.session = null;
        }
Пример #3
0
        /// <summary>
        /// Stop this task.
        /// </summary>
        /// <param name="finalStatus">The final status for this task.</param>
        public void Stop(String finalStatus)
        {
            if (this.taskURL == null)
            {
                throw new EncogCloudError("Can't stop inactive task.");
            }

            // send final status
            CloudRequest request = new CloudRequest();
            String       url     = this.taskURL + "update";

            IDictionary <String, String> args = new Dictionary <String, String>();

            args["status"] = finalStatus;
            request.PerformURLPOST(false, url, args);

            // stop
            url     = this.taskURL + "stop";
            request = new CloudRequest();
            request.PerformURLGET(false, url);
        }
Пример #4
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");
            }
        }
Пример #5
0
 /// <summary>
 /// Logout of the specified session.
 /// </summary>
 public void Logout()
 {
     CloudRequest request = new CloudRequest();
     request.PerformURLGET(false, this.session + "logout");
     this.session = null;
 }
Пример #6
0
        /// <summary>
        /// Stop this task. 
        /// </summary>
        /// <param name="finalStatus">The final status for this task.</param>
        public void Stop(String finalStatus)
        {
            if (this.taskURL == null)
            {
                throw new EncogCloudError("Can't stop inactive task.");
            }

            // send final status
            CloudRequest request = new CloudRequest();
            String url = this.taskURL + "update";

            IDictionary<String, String> args = new Dictionary<String, String>();
            args["status"] = finalStatus;
            request.PerformURLPOST(false, url, args);

            // stop
            url = this.taskURL + "stop";
            request = new CloudRequest();
            request.PerformURLGET(false, url);
        }