private void wlanInterfaceTmp_WlanConnectionNotification(Wlan.WlanNotificationData notifyData, Wlan.WlanConnectionNotificationData connNotifyData) { if (connNotifyData.profileName != "") { WlanClient wlanClientTmp = new WlanClient(); WlanClient.WlanInterface wlanInterfaceTmp = wlanClientTmp.Interfaces[0]; Dispatcher.Invoke(() => { List <Object> dataList = GetAvailableNetworkList1(); if (dataList == null) { return; } dataGridWlan1.ItemsSource = dataList; if (wlanInterfaceTmp.IsWlanConnection()) { Wlan.WlanConnectionAttributes wlanAttr = wlanInterfaceTmp.CurrentConnection; if (wlanAttr.isState == Wlan.WlanInterfaceState.Connected) { string macAddress = GetMacAddress(wlanAttr.wlanAssociationAttributes.dot11Bssid); tbState.Text = String.Format("当前设备已连接到Wlan: {0}, Mac地址: {1} IPv4地址: {2}", wlanAttr.profileName, macAddress, PathUtil.GetIPv4()); } } }); } }