Beispiel #1
0
 void poster_OnComplete(PosterAsynch.RequestState state)
 {
     throw new NotImplementedException();
 }
Beispiel #2
0
        private static NetworkResponse ExtractState(string uri, string verb, object postObject, PosterAsynch.RequestState state)
        {
            NetworkResponse response = new NetworkResponse()
            {
                URI        = uri,
                Verb       = verb,
                Downloaded = DateTime.UtcNow,
                PostObject = postObject,

                StatusCode     = state.StatusCode,
                ResponseBytes  = state.ResponseBytes,
                ResponseString = state.ResponseString,
            };

            switch (response.StatusCode)
            {
            case System.Net.HttpStatusCode.OK:
            case System.Net.HttpStatusCode.Created:
            case System.Net.HttpStatusCode.Accepted:
                break;

            case System.Net.HttpStatusCode.NoContent:
                response.Message    = String.Format("No Content returned: Result {0} for {1}", response.StatusCode, uri);
                response.Expiration = DateTime.Now;
                Device.Log.Warn(response.Message);
                break;

            default:
                response.Expiration       = DateTime.UtcNow;
                response.AttemptToRefresh = DateTime.UtcNow;
                response.Message          = String.Format("{0} failed. Received HTTP {1} for {2}", verb, response.StatusCode, uri);
                Device.Log.Error(response.Message);
                break;
            }
            return(response);
        }