Internet connection control on WM6.1

May 19, 2009 at 10:28 AM

Hi Everyone.

I'm new to C# programming so even if answer to my question is trivial, I assure that it's serious :).

I plan to build application for PDA with WM6.1 and what I need is a control over internet connection. Basically I need to know whether or not device is connected, monitor connection status and reconnect , if necessary.

I haven't used previous version of connection monitor, but in documentation I found NetworkCollection class , that seems to do job I need. This class is missing in this release.

Now, is there any other way to do it using available tools or this class wasn't "translate" to VS2008 yet ?

 

Regards,

Marius

 

May 19, 2009 at 2:15 PM

Hi Marius,

The ConnectionMonitor Block looks suitable for your use case.

You just need to handle the ConnectionStatusChanged to be notified anytime the connectivity status has changed. To check if there is an active internet connection, you can use the ActiveConnections property and for each connection call the GetNetworkName() method.

Be aware that GetNetworkName() relies on native APIs and it could fail in an active CellularConnection if it's just within cellular coverage but not actually connected. I recommend you to use try/catch/finally in such practices.

For additional details regarding the changes, please visit the wiki page: http://mobile.codeplex.com/Wiki/View.aspx?title=Changes%20from%20MCSF%20v1

Cheers,

-Joe