コード例 #1
0
        private async Task RunWifiScan()
        {
            await this._wifiScanner.ScanForNetworks();

            _report = this._wifiScanner.WiFiAdapter.NetworkReport;

            ObservableCollection <WifiList> ocwl = new ObservableCollection <WifiList>();

            foreach (var availableNetwork in _report.AvailableNetworks)
            {
                if (availableNetwork.Ssid.Length > 1)
                {
                    string icon = "";
                    if (availableNetwork.SecuritySettings.NetworkEncryptionType.ToString() == "None")
                    {
                        icon = "open_";
                    }
                    else
                    {
                        icon = "secure_";
                    }
                    icon = icon + availableNetwork.SignalBars + "bar.png";

                    WifiList wl = new WifiList {
                        Icon = "Assets/" + icon, SSID = availableNetwork.Ssid
                    };

                    ocwl.Add(wl);
                }
            }

            report_lv.ItemsSource = ocwl;
        }
コード例 #2
0
        private async void GetWifiList(object obj)
        {
            if (WifiList.Count > 0)
            {
                WifiList.Clear();
            }

            WifiList = await CrossWifi.Current.GetWifiList();
        }
コード例 #3
0
        private void report_lv_ItemClick(object sender, ItemClickEventArgs e)
        {
            WifiList item = (WifiList)e.ClickedItem;

            _selectedSSID    = item.SSID;
            txtPassword.Text = "";

            if (item.Icon.Contains("open"))
            {
                txtPassword.IsEnabled = false;
            }
            else
            {
                txtPassword.IsEnabled = true;
            }
        }