windows mobile 信号检测
2010-06-03 22:55:00 来源:WEB开发网view sourceprint?001using System;
002using System.Collections.Generic;
003using System.ComponentModel;
004using System.Data;
005using System.Drawing;
006using System.Text;
007using System.Windows.Forms;
008
009using System.Collections;
010using Microsoft.WindowsMobile.Status;
011
012
013namespace simple_snapi_ul
014{
015 public partial class Form1 : Form
016 {
017 private Timer SyncTimer = null;
018
019 public Form1()
020 {
021 InitializeComponent();
022 SetUpNotifications();
023 }
024
025
026 private ArrayList stateList = new ArrayList();
027
028 public void SetUpNotifications()
029 {
030 // This tells which states to monitor
031 SystemState s;
032 // Monitor for ActiveSync Connection
033 s = new SystemState(SystemProperty.CradlePresent);
034 s.Changed += new ChangeEventHandler(ChangeOccurred);
035 stateList.Add(s);
036 // Monitor for GPRS Connection
037 s = new SystemState(SystemProperty.PhoneGprsCoverage);
038 s.Changed += new ChangeEventHandler(ChangeOccurred);
039 stateList.Add(s);
040 //Monitor for Network Connection (eg. WiFi)
041 s = new SystemState(SystemProperty.ConnectionsNetworkCount);
042 s.Changed += new ChangeEventHandler(ChangeOccurred);
043 stateList.Add(s);
044
045
046
047 UpdateConnectionState();
048 }
049
050 public void ChangeOccurred(object sender, ChangeEventArgs args)
051 {
052 // If a change occurs
053 SystemState state = (SystemState)sender;
赞助商链接