private async Task DisplayNetworkReportAsync(WiFiNetworkReport report)
        {
            rootPage.NotifyUser(string.Format("Network Report Timestamp: {0}", report.Timestamp), NotifyType.StatusMessage);

            ResultCollection.Clear();
            ConcurrentDictionary <string, WiFiNetworkDisplay> dictionary = new ConcurrentDictionary <string, WiFiNetworkDisplay>();

            foreach (var network in report.AvailableNetworks)
            {
                if (!String.IsNullOrEmpty(network.Ssid))
                {
                    var item = new WiFiNetworkDisplay(network, firstAdapter);
                    dictionary.TryAdd(network.Ssid, item);
                }
            }

            var values = dictionary.Values;

            foreach (var item in values)
            {
                /*await*/ item.UpdateAsync();
                if (IsConnected(item.AvailableNetwork))
                {
                    ResultCollection.Insert(0, item);
                    ResultsListView.SelectedItem = ResultsListView.Items[0];
                    ResultsListView.ScrollIntoView(ResultsListView.SelectedItem);
                    SwitchToItemState(item.AvailableNetwork, WifiConnectedState, false);
                }
                else
                {
                    ResultCollection.Add(item);
                }
            }
            ResultsListView.Focus(FocusState.Pointer);
        }
        private void SetSelectedItemState(WiFiNetworkDisplay network)
        {
            if (network == null)
            {
                return;
            }

            if (IsConnected(network.AvailableNetwork))
            {
                SwitchToItemState(network, WifiConnectedState, true);
            }
            else
            {
                SwitchToItemState(network, WifiConnectState, true);
            }
        }
        private async Task DisplayNetworkReportAsync(WiFiNetworkReport report)
        {
            ResultCollection.Clear();

            foreach (var network in report.AvailableNetworks)
            {
                var item = new WiFiNetworkDisplay(network, firstAdapter);
                /*await*/ item.UpdateAsync();
                if (IsConnected(network))
                {
                    ResultCollection.Insert(0, item);
                    ResultsListView.SelectedItem = ResultsListView.Items[0];
                    ResultsListView.ScrollIntoView(ResultsListView.SelectedItem);
                    SwitchToItemState(network, WifiConnectedState, false);
                }
                else
                {
                    ResultCollection.Add(item);
                }
            }
            ResultsListView.Focus(FocusState.Pointer);
        }
Esempio n. 4
0
        private async Task DisplayNetworkReportAsync(WiFiNetworkReport report)
        {
            rootPage.NotifyUser(string.Format("Network Report Timestamp: {0}", report.Timestamp), NotifyType.StatusMessage);

            ResultCollection.Clear();

            foreach (var network in report.AvailableNetworks)
            {
                var item = new WiFiNetworkDisplay(network, firstAdapter);
                /*await*/ item.UpdateAsync();
                if (IsConnected(network))
                {
                    ResultCollection.Insert(0, item);
                    ResultsListView.SelectedItem = ResultsListView.Items[0];
                    ResultsListView.ScrollIntoView(ResultsListView.SelectedItem);
                    SwitchToItemState(network, WifiConnectedState, false);
                }
                else
                {
                    ResultCollection.Add(item);
                }
            }
            ResultsListView.Focus(FocusState.Pointer);
        }