Exemplo n.º 1
0
        private async void PremiseSettingChangedExecute(object obj)
        {
            var list = new List <IUserWLanTimeEntryType>();

            list.AddRange(_userWlanSettingsService.WLansBoundToTimeEntryTypes);
            var availableNetworkList = await _connectivityService.GetAvailableNetworkList();

            var unlistedWLanTimeEntryTypes = availableNetworkList
                                             .Select(x => new UserWLanTimeEntryType(0, x))
                                             .Where(newWlans => list.All(x => x.WifiName != newWlans.WifiName));

            list.AddRange(unlistedWLanTimeEntryTypes);

            foreach (var userWLanTimeEntryType in list)
            {
                userWLanTimeEntryType.Connected = userWLanTimeEntryType.WifiName == await _connectivityService.GetWLanIdentification();
            }

            WLansBoundToTimeEntryTypes.Clear();
            WLansBoundToTimeEntryTypes.AddRange(list.Select(x =>
            {
                var timeEntryTypes = TimeEntryTypes.SingleOrDefault(t => t.Id == x.DefaultTimeEntryTypeId);
                return(new UserWLanTimeEntryTypeItemViewmodel(timeEntryTypes, x));
            }));
            WLansBoundToTimeEntryTypes.ItemChanged += WLansBoundToTimeEntryTypesOnCollectionChanged;
        }
Exemplo n.º 2
0
        public async Task <IEnumerable <IUserWLanTimeEntryType> > FindAnyUserWLanMatches()
        {
            var availableNetworkList = await _connectivityService.GetAvailableNetworkList();

            var list = new List <IUserWLanTimeEntryType>();

            foreach (var userWLanTimeEntryTypeItemViewmodel in WLansBoundToTimeEntryTypes)
            {
                if (availableNetworkList.Any(x => x == userWLanTimeEntryTypeItemViewmodel.WifiName))
                {
                    list.Add(userWLanTimeEntryTypeItemViewmodel);;
                }
            }
            return(list);
        }