private void LoadSettings() { LocationIsChecked = InMemoryApplicationSettingModel.GetSetting(ApplicationSetting.AllowLocation).Value; UseMetricIsChecked = InMemoryApplicationSettingModel.GetSetting(ApplicationSetting.UseMetric).Value; ShowWeatherIsChecked = InMemoryApplicationSettingModel.GetSetting(ApplicationSetting.ShowWeather).Value; UseUberIsChecked = InMemoryApplicationSettingModel.GetSetting(ApplicationSetting.UseUber).Value; StoreRecentIsChecked = InMemoryApplicationSettingModel.GetSetting(ApplicationSetting.StoreRecent).Value; PopulateLocationIsChecked = InMemoryApplicationSettingModel.GetSetting(ApplicationSetting.AutoPopulateLocation).Value; PopulateMostUsedIsChecked = InMemoryApplicationSettingModel.GetSetting(ApplicationSetting.AutoPopulateMostFrequent).Value; PopulateRecentIsChecked = InMemoryApplicationSettingModel.GetSetting(ApplicationSetting.AutoPopulateMostRecent).Value; SkipTripSelectionIsChecked = InMemoryApplicationSettingModel.GetSetting(ApplicationSetting.SkipTripSelection).Value; ShowAnnouncementsApplicationBarIsChecked = InMemoryApplicationSettingModel.GetSetting(ApplicationSetting.ShowAnnouncementsApplicationBar).Value; ShowTripApplicationBarIsChecked = InMemoryApplicationSettingModel.GetSetting(ApplicationSetting.ShowTripApplicationBar).Value; LoginUberIsChecked = InMemoryApplicationSettingModel.GetSetting(ApplicationSetting.LoginUber).Value; }
protected override void PageLoaded() { pageLoaded = true; Messenger.Default.Register <PointOnMapMessage>(this, (action) => SelectPointOnMap(action)); ClearSearchTextBox(); ShowLoader(); if (isPointA) { PageTitleMessage.Send(AppResources.HeaderPointA); } else { PageTitleMessage.Send(AppResources.HeaderPointB); } base.PageLoaded(); Stations.Clear(); SearchResults.Clear(); if (InMemoryApplicationSettingModel.GetSetting(ApplicationSetting.AllowLocation).Value) { locationIsAllowed = true; if (user.IsLocationUptodate) { UserLocationFound(new GpsWatcherResponseMessage(true, user.LastKnownGeneralLocation, GpsWatcherResponseMessageReason.Coordinate)); } else { RegisterWatcher(); } } else { locationIsAllowed = false; if (isStopSearch) { AddStations(); } else { AddSearchResultsNearby(); } } pageLoaded = false; }
private void SetPopupVisibilities() { HidePopups(); if (base.user != null) { if (!user.DismissedLocationPopup) { if (!InMemoryApplicationSettingModel.GetSetting(ApplicationSetting.AllowLocation).Value) { GpsPopupVisibility = Visibility.Visible; return; } } if (!userDismissedPrivateModesPopup) { List <OperatorSetting> operatorSettings = UnitOfWork.OperatorSettingRepository.GetAll().ToList(); int numberUnconfiguredPrivateOperators = 0; foreach (PublicTransportOperator publicTransportOperator in UnitOfWork.PublicTransportOperatorRepository.GetAll().ToList().Where(x => !x.IsPublic)) { if (!operatorSettings.Where(x => x.OperatorName == publicTransportOperator.Name).FirstOrDefault().HasBeenModified) { numberUnconfiguredPrivateOperators += 1; } } if (numberUnconfiguredPrivateOperators > 0) { PrivateModesPopupVisibility = Visibility.Visible; PrivateModePopupText = string.Format(AppResources.ModePrivateTransportPopupText, numberUnconfiguredPrivateOperators.ToString()); return; } } if (!user.DismissedLoginUberPopup) { LoginUberPopupVisibility = Visibility.Visible; return; } if (!user.DismissedRateAppPopup && user.AppUsageCount > 5) { RateAppPopupVisibility = Visibility.Visible; return; } } }
protected override void PageLoaded() { base.PageLoaded(); SetPopupVisibilities(); if (InMemoryApplicationSettingModel.GetSetting(ApplicationSetting.ShowWeather).Value) { if (weather == null || weather.LastRefreshedDate < DateTime.Now.AddHours(-1)) { weather = UnitOfWork.WeatherRepository.Get(); } if (weather != null) { WeatherIconImageSource = new BitmapImage(new Uri(weather.Icon, UriKind.Relative)); WeatherIconImageVisibility = Visibility.Visible; } } else { WeatherIconImageVisibility = Visibility.Collapsed; } }