嗨,我是 Windows Phone 开发的新手,可能是我在编写代码时做了一些尴尬的事情,我可以做类似的事情吗
button_click()
{
this.NavigationService.Navigate(new Uri("/HttpHandler.xaml", UriKind.Relative));
WebHandler.Make_url_HandleResponse("someurl", 1);
}
/*In HttpHandler Class having object Webhandler in previous class*/
public void Make_url_HandleResponse(string Uri, int req_id)
{
try
{
uri = new Uri(Uri);
}
catch (Exception exception)
{
Debug.WriteLine(exception.Message);
MessageBox.Show(exception.Message);
}
request = (HttpWebRequest)HttpWebRequest.Create(uri.AbsoluteUri);
Debug.WriteLine("The url is" + uri);
}
public void request_CallBack(IAsyncResult result)
{
try
{
//var request = (HttpWebRequest) result.AsyncState;
Stream stream;
string ext_str;
char[] separator = { '/' };
HttpWebResponse response = (HttpWebResponse)request.EndGetResponse(result);
using (stream = response.GetResponseStream())
{
/* here I want to navigate to a new page*/
Deployment.Current.Dispatcher.BeginInvoke(delegate()
{
try
{
downloadingProgress.IsIndeterminate = false;
downloadingProgress.Visibility = Visibility.Collapsed;
stkDownloading.Visibility = Visibility.Collapsed;
this.NavigationService.Navigate(new Uri("/NewUser.xaml",UriKind.Relative));
}
catch (Exception e)
{ }
});
}
我只是想问我是否可以从 httphandler 页面导航到另一个页面。提前致谢