private void GetNetwork() { Wlan.WlanConnectionAttributes wlanAttr = WlanClient.GetWlanConnectInfo(); if (wlanAttr.profileName != null) { ImageWlan.Source = new BitmapImage(new Uri("Resources/Images/wifi.png", UriKind.RelativeOrAbsolute)); _isWlan = true; } else { ImageWlan.Source = new BitmapImage(new Uri("Resources/Images/wifi2.png", UriKind.RelativeOrAbsolute)); } }
private void MySettingPage_Loaded(object sender, RoutedEventArgs e) { List <Object> dataList = GetAvailableNetworkList1(); dataGridWlan1.ItemsSource = dataList != null?GetAvailableNetworkList1() : null; dataGridWlan2.ItemsSource = GetAvailableNetworkList2(); string ipv4 = PathUtil.GetIPv4(); Wlan.WlanConnectionAttributes wlanAttr = WlanClient.GetWlanConnectInfo(); if (wlanAttr.profileName != null) { string macAddress = GetMacAddress(wlanAttr.wlanAssociationAttributes.dot11Bssid); tbState.Text = String.Format("当前设备已连接到Wlan: {0}, Mac地址: {1} IPv4地址: {2}", wlanAttr.profileName, macAddress, PathUtil.GetIPv4()); } else { tbState.Text = string.Format("网络数据连接IPv4: {0}", PathUtil.GetIPV4ByManagementClass()); } InitializeEmailConfiguration(); }