czytając moją odpowiedź json z prośby o wysłanie

Zrobiłem klasę żądania post, której mogłem użyć ponownie, aby żądania POST były wysyłane do zewnętrznego interfejsu API i zwracać obiekty, które mi wysyłają (JSON):

class PostRequest
    {
        private Action<DataUpdateState> Callback;

        public PostRequest(string urlPath, string data, Action<DataUpdateState> callback)
        {
            Callback = callback;

            // form the URI
            UriBuilder fullUri = new UriBuilder(urlPath);
            fullUri.Query = data;

            // initialize a new WebRequest
            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(fullUri.Uri);
            request.Method = "POST";

            // set up the state object for the async request
            DataUpdateState dataState = new DataUpdateState();
            dataState.AsyncRequest = request;

            // start the asynchronous request
            request.BeginGetResponse(new AsyncCallback(HandleResponse),
                dataState);
        }

        private void HandleResponse(IAsyncResult asyncResult)
        {
            // get the state information
            DataUpdateState dataState = (DataUpdateState)asyncResult.AsyncState;
            HttpWebRequest dataRequest = (HttpWebRequest)dataState.AsyncRequest;

            // end the async request
            dataState.AsyncResponse = (HttpWebResponse)dataRequest.EndGetResponse(asyncResult);
            if (dataState.AsyncResponse.StatusCode.ToString() == "OK")
            {
                Callback(dataState); // THIS IS THE LINE YOU SHOULD LOOK AT :)
            }
        }
    }

    public class DataUpdateState
    {
        public HttpWebRequest AsyncRequest { get; set; }
        public HttpWebResponse AsyncResponse { get; set; }
    }
}

metoda Callback pobiera obiekt datastate i przesuwa go do tej funkcji:

    public void LoadDashboard( DataUpdateState dataResponse )
    {
        Stream response = dataResponse.AsyncResponse.GetResponseStream();
        //Encoding encode = System.Text.Encoding.GetEncoding("utf-8");
        //StreamReader readStream = new StreamReader(response, encode);
        //readStream.Close();


        Deployment.Current.Dispatcher.BeginInvoke(() => {
            App.RootFrame.Navigate(new Uri("/Interface.xaml", UriKind.RelativeOrAbsolute));
        });
    }

Nie jestem teraz pewien, jak uzyskać treść odpowiedzi wysłanej do mnie z interfejsu API. Zwraca format json, muszę być w stanie zmapować go do ładnej klasy C # i użyć go do wyświetlania rzeczy w telefonie.

Nie mogę znaleźć przykładu, który nie używa JSON.NET (który nie ma zespołu dla Windows Phone 8)

To jest błąd Instaluję klasę HTTPClient:

Attempting to resolve dependency 'Microsoft.Bcl (≥ 1.1.3)'.
Attempting to resolve dependency 'Microsoft.Bcl.Build (≥ 1.0.4)'.
Successfully installed 'Microsoft.Bcl.Build 1.0.10'.
Successfully installed 'Microsoft.Bcl 1.1.3'.
Successfully installed 'Microsoft.Net.Http 2.2.13'.
Successfully added 'Microsoft.Bcl.Build 1.0.10' to UnofficialPodio.
Executing script file ***\packages\Microsoft.Bcl.Build.1.0.10\tools\Install.ps1'.
This reference cannot be removed from the project because it is always referenced by the compiler.
This reference cannot be removed from the project because it is always referenced by the compiler.
This reference cannot be removed from the project because it is always referenced by the compiler.
This reference cannot be removed from the project because it is always referenced by the compiler.
Executing script file ***\packages\Microsoft.Bcl.Build.1.0.10\tools\Uninstall.ps1'.
Successfully uninstalled 'Microsoft.Bcl 1.1.3'.
Successfully uninstalled 'Microsoft.Bcl.Build 1.0.10'.
Install failed. Rolling back...
Failed to add reference to 'System.IO'.
"{
    \"access_token\": \"123803120312912j\",
    \"token_type\": \"bearer\",
    \"ref\": {
        \"type\": \"user\",
        \"id\": 123123
    },
    \"expires_in\": 28800,
    \"refresh_token\": \"234234f23f423q432f\"
}"

...

public class Auth
{

    [DataMember(Name = "access_token")]  
    public string AccessToken { get; set; }

    [DataMember(Name = "token_type")]  
    public string TokenType { get; set; }

    [DataMember(Name = "expires_in")]  
    public string ExpiresIn { get; set; }

    [DataMember(Name = "refresh_token")]  
    public string RefreshToken { get; set; }

    //[DataMember(Name = "ref")]  
    //public string Ref { get; set; }

}

questionAnswers(2)

yourAnswerToTheQuestion