简体   繁体   中英

Windows Phone SDK Network

I am getting used to the Windows Phone SDK in Visual Studio.

Right now I am writing a simple web browser so that I can build off of it in the future in C#.

What I am having an issue with is - if the phone doesn't have any signal:

  • I don't want the application to redirect to the generic could not find the website that you are looking for.
  • I would like it to redirect to a new page that I have control over.

So my basic question is this - is there a way to detect whether the phone has a connection to the network - or better yet if the phone redirects to a new website?

I need that because I could potentially catch the error and display something like you aren't connected to a network please try again once you have connected.

Yes you can find whether your phone is connected with network or not in windows phone try this add a name space using Microsoft.Phone.Net.NetworkInformation;

if (DeviceNetworkInformation.IsNetworkAvailable)
{
MessageBox.Show("Network");
}
else
{
MessageBox.Show("No Network");
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM