locked
Save and Retrieve Image from Picture Library

    Question

  • I am trying to save image in local Picture Library  Now to load the sample data, the HTTP Client is used, which would make a GET request, and receive the data in it’s ReadAsStringAsync method.

      protected async override void LoadState(Object navigationParameter, 
                Dictionary<String, Object> pageState)
            {
                loadingRing.Visibility = Visibility.Visible;
    
                var client = new HttpClient();
                var topsyUri = TopsySearchEngine.TopsySearchUrl("Windows 8", "image");
                var response = await client.GetAsync(topsyUri);
                var responseString = await response.Content.ReadAsStringAsync();
    
                var stuff = JObject.Parse(responseString);
                TopsyData = JsonConvert.DeserializeObject<TopsyResponse>(stuff["response"].ToString());
    
    
    
                this.DefaultViewModel["TopsyData"] = TopsyData;
    
                loadingRing.Visibility = Visibility.Collapsed;
            }
    

    To load the sample data, the HTTP Client is used, which would make a GET request, and receive the data in it’s ReadAsStringAsync method But it show exceptiontion at 

     TopsyData = JsonConvert.DeserializeObject<TopsyResponse>(stuff["response"].ToString());


    Saturday, August 16, 2014 7:21 PM

All replies

  • Hi Faizan,

    The error indicates that there is something wrong with the json object. But you need to search for how to debug this problem by yourself. Because I cannot guess the response of Content.ReadAsStringAsync method. Add a breakpoint to your code, try to debug it step by step.

    If you need more help, please post the value of responseString object.

    Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, August 18, 2014 9:08 AM
    Moderator
  • Hi Faizan,

    I think you may also use some internal channels to get help if you are working for Microsoft.

    Anyway, you did not provide enough information for us to analysis what's happening, you even did not tell what the exception message is.

    As Herro suggested, you may need to set some breakpoints on your code to validate all parts of the code got a correct input value and a correct output value. However you also mentioned you are working with Image but I did not see any part of your code related with image but only string. We may need more information from you for a better support.

    Thanks for your understanding.

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Tuesday, August 26, 2014 5:39 AM
    Moderator
  • Hi all 

    there is some issue with  Json object i fixed that later on 

    Thanks for guidance

    Thursday, September 4, 2014 2:52 PM