windows phone 8.1中如何动态传递参数

How to pass the parameters dynamically in windows phone 8.1

哪位好心指导我在c#中动态传递参数。我分配了两个文本框,这些文本框中的用户输入必须作为参数传递。如果我传递静态参数,我会收到服务器的响应。

这是我的代码。

        string AuthServiceUri = "my url";
        HttpWebRequest spAuthReq = HttpWebRequest.Create(AuthServiceUri) as HttpWebRequest; 
        spAuthReq.ContentType = "application/json"; 
        spAuthReq.Method = "POST"; 
        spAuthReq.BeginGetRequestStream(new AsyncCallback(GetRequestStreamCallback), spAuthReq);

    }
    void GetRequestStreamCallback(IAsyncResult callbackResult) 
    {

        HttpWebRequest myRequest = (HttpWebRequest)callbackResult.AsyncState; 
        Stream postStream = myRequest.EndGetRequestStream(callbackResult);
        string postData = "id=1234567890&keyword=otp&message=8320926"; //passing static parameters & here i need to pass the text boxes data in id and message field.
        byte[] byteArray = Encoding.UTF8.GetBytes(postData); 
        postStream.Write(byteArray, 0, byteArray.Length); 
        postStream.Dispose(); 
        myRequest.BeginGetResponse(new AsyncCallback(GetResponsetStreamCallback), myRequest);

    } 

非常感谢您的帮助。

您可以使用 Text 属性 访问 TextBox 输入。
假设你有两个TextBoxes名字tb1和tb2,应该是这样的:

string postData = "id=" + tb1.Text + "&keyword=otp&message=" + tb2.Text;