Answer the question
In order to leave comments, you need to log in
Refresh page Windows Phone?
There is a code, the essence is simple - we take information from the site, process it and give it to the user as a string in a TextBlock. I use HttpWebRequest HttpWebResponse, all is well.
The problem is this: I have the code in Page_Loaded, it is loaded 1 time. And if you change a line on the site and make a transition between pages in the application, nothing happens. The Application Bar has a refresh button with the following code:
private void ApplicationBarIconButton_Refresh(object sender, EventArgs e)
{
NavigationService.Navigate(new Uri("/MainPage.xaml?" + DateTime.Now.Ticks, UriKind.Relative));
}
private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
{
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(@"site.com/.../.../");
request.BeginGetResponse(new AsyncCallback(ReadWebRequestCallback), request);
}
public void ReadWebRequestCallback(IAsyncResult callbackResult)
{
HttpWebRequest myRequest = (HttpWebRequest)callbackResult.AsyncState;
HttpWebResponse myResponse = (HttpWebResponse)myRequest.EndGetResponse(callbackResult);
StreamReader readStream = new StreamReader(myResponse.GetResponseStream());
{
string results = readStream.ReadToEnd();
///обработка и дальше вывод вывод
Dispatcher.BeginInvoke(() => tbk_text.Text = Convert.ToString(str);
}
readStream.Close();
myResponse.Close();
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question