views:

64

answers:

3

Hi, to be honest, I am kind of lazy at the moment. I tried a 3 minute search, but I get a lot of Windows7 and C# related stuff, not what I am looking for. Its for a pet project anyway, so I just give it a try:

Is there any way to find out HOW I am connected to the internet in WP7?

Background: Any app which is written for fun purposes, e.g. a picture sorting app. I want it to sync a lot of stuff with my server when I am online via WLAN (e.g. 200mB), but it should not do anything if I am using my expensive GPRS connection...

Thanks for any tips, actually a RTFM with a good search word for google would to the trick :-)

Chris

+1  A: 

Have a look at this link:

A value from the NetworkInterfaceType enumeration identifying the network type. The value will be one of: Wireless80211 for a Wi-Fi connection, MobileBroadband for a cellular connection, or None if no connection is available.

ChristopheD
Also have a look at the comments on this question: http://stackoverflow.com/questions/3680374/is-there-an-easier-fast-way-to-detect-whether-the-windows-phone-7-device-has-an/3680816#3680816
ChristopheD
Thanks a lot, wow, if it is always that fast, google may be out of jobs tomorrow :-) I give the answer mark to vlad, you got plenty of points already :-) [even though your stacklink is nicer then the ms link, i do not like their site :-) ]
Christian
+1  A: 

I believe this answers your question

from the link:

The application must register for the NetworkAddressChanged event of the System.Net.NetworkInformation.NetworkChange class. On receipt of the event the application can use the NetworkInterfaceType property to determine the current connection state.

vlad
+1  A: 

Here's a quick sample demonstrating a test of the NetworkInterface class:

if (System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable())
{
    return NetworkInterface.NetworkInterfaceType;
}
Matt Lacey