本文介绍了WiFi开机事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 全部好, 当我转身时,WiFi开机事件没有被触发关于wifi电源。 其他一些事件RotationDisplay正在被解雇......完全混淆.... I编码如下: public partial class Form1 : 表格 { public AccessPointCollection m_nearbyAPs; SystemState wifist; public Form1() { InitializeComponent(); wifist = new SystemState ( SystemProperty .WiFiStatePowerOn); wifist.Changed + = new ChangeEventHandler (wifist_Changed); } void wifist_Changed( object sender,Microsoft.WindowsMo​​bile.Status。 ChangeEventArgs args) { / SystemProperty wifiSate1 =(SystemProperty)args.NewValue; if(wifiSate1 == SystemProperty .WiFiStatePow erOn) { WiFi_Connect(); } } public void WiFi_Connect( ) { AdapterCollection adapters = Networking .GetAdapters(); foreach ( Adapter 适配器 in adapter) { 尝试 { if (adapter.IsWireless) { m_nearbyA Ps = adapter.NearbyAccessPoints; foreach ( AccessPoint ap in m_nearbyAPs) { MessageBox .Show(ap.Name.ToString()); if (ap.Name.ToString()。Equals( " xyz" )) { EAPParameters eapp = new EAPParameters (); eapp.Enable8021x = true ; eapp.AuthData = IntPtr .Zero; eapp.AuthDataLen = 0; eapp.EapType = EAPType .PEAP; eapp.EapFlags = EAPFlags .Enabled; bool abc = false ; abc = adapter.SetWirelessSettingsAddEx(ap.Name, true , " xyz" ,1, AuthenticationMode .Ndis802_11AuthModeOpen, WEPStatus 。 Ndis802_11WEPEnabled,eapp); adapter.RebindAdapter(); if (abc == true ) { MessageBox .Show( " Connected" ); // notification1.Text =" WiFi Connected"; } else { MessageBox .Show( "失败" ); // notification1.Text =" WiFi DisConnected"; } } } } } catch ( 例外 ex) { } } 我还使用了一些opennetcf的API连接到接入点。 请帮帮我.... 解决方案 hi 我认为更好的帖子在 opennetcf.com。 这会给出好的结果。 谢谢你 Hi All,WiFi power on event is not getting fired when i turn on the wifi power.Some other event RotationDisplay is getting fired ...totally confused....I have coded it like this: public partial class Form1 : Form{public AccessPointCollection m_nearbyAPs;SystemState wifist;public Form1(){InitializeComponent();wifist = new SystemState(SystemProperty.WiFiStatePowerOn);wifist.Changed += new ChangeEventHandler(wifist_Changed);}void wifist_Changed(object sender, Microsoft.WindowsMobile.Status.ChangeEventArgs args ){/SystemProperty wifiSate1 = (SystemProperty)args.NewValue;if (wifiSate1 ==SystemProperty .WiFiStatePowerOn ){WiFi_Connect();}   }public void WiFi_Connect(){AdapterCollection adapters = Networking.GetAdapters();foreach (Adapter adapter in adapters){try{if (adapter.IsWireless){m_nearbyAPs = adapter.NearbyAccessPoints;foreach (AccessPoint ap in m_nearbyAPs){MessageBox.Show(ap.Name.ToString());if (ap.Name.ToString().Equals("xyz")){EAPParameters eapp = new EAPParameters();eapp.Enable8021x = true;eapp.AuthData = IntPtr.Zero;eapp.AuthDataLen = 0;eapp.EapType = EAPType.PEAP;eapp.EapFlags = EAPFlags.Enabled;bool abc = false;abc = adapter.SetWirelessSettingsAddEx(ap.Name, true, "xyz", 1, AuthenticationMode.Ndis802_11AuthModeOpen, WEPStatus.Ndis802_11WEPEnabled, eapp);adapter.RebindAdapter();if (abc == true){MessageBox.Show("Connected");// notification1.Text = "WiFi Connected";}else{MessageBox.Show("failed");// notification1.Text = "WiFi DisConnected";}} }}}catch (Exception ex){} } I have also used some opennetcf's APIs for connecting to acces point. Please help me out.... 解决方案 hii think better ur post in opennetcf.com.that's give good result.thank you 这篇关于WiFi开机事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
09-09 22:39