public RequestMessage ResultToMessage(ResponseWrapper response )
 {
     switch(response.ResponseStatus)
     {
         case ResponseStatus.NoInternet:
             return new RequestMessage(_resources.NoInternet, GeometryPaths.NoInternet);
         case ResponseStatus.HttpError:
             return new RequestMessage(_resources.ErrorConnecting, GeometryPaths.NoInternet);
         case ResponseStatus.SuccessWithNoData:
             return new RequestMessage(_resources.NoData, GeometryPaths.NoResults);
         case ResponseStatus.ParserException:
         case ResponseStatus.ClientSideError:
             return new RequestMessage(_resources.ClientSideError, GeometryPaths.NoResults);
         case ResponseStatus.SuccessWithResult:
             return new RequestMessage(_resources.Success, null) { MessageType = RequestMessageType.Info };
         default:
             return new RequestMessage("", null) { MessageType = RequestMessageType.Info };
     }
 }
Esempio n. 2
0
 /// <summary>
 /// This method is responsible for adding new items to the collection
 /// and updating current page number.
 /// </summary>
 /// <param name="response"></param>
 private void UpdateCollection(ResponseWrapper<RecentPhotosResponse> response)
 {
     CurrentPageOfRecent = response.Result.Photos.Page;
     var list = response.Result.Photos.List;
     foreach (var photo in list)
     {
         PhotosCollection.Add(photo);
     }
 }
 /// <summary>
 /// This method is responsible for adding new items to the collection
 /// and updating current page number.
 /// </summary>
 /// <param name="response"></param>
 private void UpdateSearchCollection(ResponseWrapper<SearchPhotosResponse> response)
 {
     CurrentPageOfSearch = response.Result.Photos.Page;
     var list = response.Result.Photos.List;
     foreach (var photo in list)
     {
         SearchCollection.Add(photo);
     }
 }