Exemple #1
0
        /// <summary>
        /// Refresh selected access point properties.
        /// </summary>
        private async Task RefreshAccessPointAsync()
        {
            BusyStateManager.EnterBusy();
            BusyStateManager.SetMessage(SeverityType.Info,
                                        $"Refreshing the status of access point [{SelectedAccessPoint.Ssid}].");

            IEnumerable <AccessPoint> accessPoints = await _mainController.GetWiFiAccessPointsAsync();

            AccessPoint accessPoint = accessPoints.Where(x => x.Id == SelectedAccessPoint.Id &&
                                                         x.Ssid == SelectedAccessPoint.Ssid &&
                                                         x.ProfileName == SelectedAccessPoint.Ssid).FirstOrDefault();

            /* If access point not found, repeat search without specifying profile name. */
            if (accessPoint == default(AccessPoint))
            {
                accessPoint = accessPoints.Where(x => x.Id == SelectedAccessPoint.Id &&
                                                 x.Ssid == SelectedAccessPoint.Ssid).FirstOrDefault();
            }

            /* Update access point in view. */
            if (accessPoint != default(AccessPoint))
            {
                AccessPoints.Clear();
                AccessPoints.Add(accessPoint);
                SelectedAccessPoint = accessPoint;
            }

            /* Update SelectedInterface status, (isConnected). */
            IEnumerable <Interface> interfaces = await _mainController.GetWiFiInterfacesAsync();

            Interface wiFiInterface = interfaces.Where(x => x.Id == SelectedInterface.Id).FirstOrDefault();

            if (wiFiInterface != default(Interface))
            {
                SelectedInterface = wiFiInterface;
            }

            BusyStateManager.SetMessage(SeverityType.None);
            BusyStateManager.ExitBusy();
        }
Exemple #2
0
 /// <summary>
 /// Remove selected access point.
 /// </summary>
 public void RemoveAccessPointCmd()
 {
     AccessPoints.Clear();
     SelectedAccessPoint = null;
     SelectedInterface   = null;
 }