Beispiel #1
0
            public override void OnReceive(Context context, Intent intent)
            {
                IList <ScanResult> scanwifinetworks = wifi.ScanResults;

                foreach (ScanResult wifinetwork in scanwifinetworks)
                {
                    WiFiNetworks.Add(wifinetwork.Ssid);
                }
                wifis(WiFiNetworks);
            }
Beispiel #2
0
        private async Task InitializeNetworksAsync(WiFiNetworkReport networkReport)
        {
            WiFiNetworks.Clear();
            foreach (var nw in networkReport.AvailableNetworks)
            {
                var item = new WiFiNetworkViewModel(nw, _wifiAdapter);
                await item.UpdateAsync();

                if (IsConnected(nw))
                {
                    WiFiNetworks.Insert(0, item);
                    SelectedWiFiNetwork = WiFiNetworks[0];
                    OnSelect?.Invoke(this, EventArgs.Empty);
                }
                else
                {
                    WiFiNetworks.Add(item);
                }
            }
        }