問題描述
分析
Windows Phone 7和之前的Windows Mobile平台不同,就目前SDK的版本來講,開發者無法通過API來直接打開、關閉網絡連接配接,比如WiFi、Cellular、藍牙等裝置。
結論
解決的方案就是應用程式中添加彈出連接配接設定頁面的方法,讓使用者自己來操作。如
1 ConnectionSettingsTask connectionSettingsTask = new ConnectionSettingsTask();
2
3 connectionSettingsTask.ConnectionSettingsType = ConnectionSettingsType.WiFi;
4
5 connectionSettingsTask.Show();
如ConnectionSettingsType.Bluetooth、ConnectionSettingsType.Cellular、ConnectionSettingsType.AirplaneMode(飛行模式)。
本文轉自施炯部落格園部落格,原文連結:http://www.cnblogs.com/dearsj001/archive/2012/06/11/WindowsPhoneDevNotes_NetworkSettings.html,如需轉載請自行聯系原作者