Example #1
0
        /// <summary>
        /// Called upon the successful completion of the preview (cell confirmation) request and
        /// response.
        /// </summary>
        /// <param name="request">The request object used.</param>
        /// <param name="response">The response object that can be type casted to your expected response type.</param>
        private void PreviewRequestComplete(HttpWebRequest request, object response)
        {
            if (response == null)
            {
                this.ApplyResponse(HttpStatusCode.InternalServerError, "Confirmation response is missing or empty.");
                return;
            }

            PreviewResponse responseObj = (PreviewResponse)response;

            this.confirmed = responseObj.payload.destination.wireless;
        }
Example #2
0
        /// <summary>
        /// Called when any error occurs in the transceiver. Typically
        /// this will be a resposne error but can also point to something
        /// more simple like a missing or invalid URI.
        /// </summary>
        /// <param name="request">The request object if it has been initalized. Null otherwise.</param>
        /// <param name="status">An HTTP status code that most represents the problem that occured.</param>
        /// <param name="error">A more descriptive error of what happened.</param>
        /// <param name="resposne">The HTTP response object if one is available. Null otherwise.</param>
        private void PreviewRequestError(HttpWebRequest request, HttpStatusCode status, string error, object response)
        {
            this.confirmed = false;

            string errorCode = status.ToString();
            string errorText = error;

            if (response != null)
            {
                PreviewResponse responseObj = (PreviewResponse)response;
                errorCode = responseObj.error.code;
                errorText = responseObj.error.description;
            }

            this.ApplyResponse(status, String.Format("{0}: {1}", errorCode, errorText));
        }