private async void DetectLocation_Click(object sender, RoutedEventArgs e) { LocationInfoStack.Visibility = Visibility.Visible; LocatingYou.Visibility = Visibility.Visible; LocationProgress.Visibility = Visibility.Visible; var coords = await Geolocation.GetLocationInfo(); if (coords.Latitude == 0 && coords.Longitude == 0) { LocationProgress.Visibility = Visibility.Collapsed; LocatingYou.Visibility = Visibility.Collapsed; CantLocateYou.Visibility = Visibility.Visible; } else { var plid = await PlacesSearch.GetCityNameByCoordinate(coords.Latitude, coords.Longitude); if (plid != null) { ChoosenPlace = new PlaceInfo() { Latitude = plid.Latitude, Longitude = plid.Longitude, DisplayName = plid.DisplayName, PlaceId = plid.PlaceId }; DefaultLocation.Text = plid.DisplayName; LocationInfoStack.Visibility = Visibility.Collapsed; } else { CantLocateYou.Visibility = Visibility.Visible; } } }
private async void CitiesSearch_TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args) { if (args.Reason == AutoSuggestionBoxTextChangeReason.UserInput && sender.Text.Length > 2) { var result = (await PlacesSearch.PlaceAutocomplate(sender.Text)); sender.ItemsSource = result; } }
public Schema() : base() { InstanceType = typeof(__Autocomp__); ClassName = "AutocompletePage"; Properties.ClearExposed(); Html = Add <__TString__>("Html"); Html.DefaultValue = "/KitchenSink/AutocompletePage.html"; Html.SetCustomAccessors((_p_) => { return(((__Autocomp__)_p_).__bf__Html__); }, (_p_, _v_) => { ((__Autocomp__)_p_).__bf__Html__ = (System.String)_v_; }, false); PlacesSearch = Add <__TString__>("PlacesSearch$"); PlacesSearch.DefaultValue = ""; PlacesSearch.Editable = true; PlacesSearch.SetCustomAccessors((_p_) => { return(((__Autocomp__)_p_).__bf__PlacesSearch__); }, (_p_, _v_) => { ((__Autocomp__)_p_).__bf__PlacesSearch__ = (System.String)_v_; }, false); PlacesSearch.AddHandler((Json pup, Property <String> prop, String value) => { return(new Input.PlacesSearch() { App = (AutocompletePage)pup, Template = (TString)prop, Value = value }); }, (Json pup, Starcounter.Input <String> input) => { ((AutocompletePage)pup).Handle((Input.PlacesSearch)input); }); PlacesText = Add <__TString__>("PlacesText"); PlacesText.DefaultValue = ""; PlacesText.SetCustomAccessors((_p_) => { return(((__Autocomp__)_p_).__bf__PlacesText__); }, (_p_, _v_) => { ((__Autocomp__)_p_).__bf__PlacesText__ = (System.String)_v_; }, false); ClearPlaces = Add <__TLong__>("ClearPlaces$"); ClearPlaces.DefaultValue = 0L; ClearPlaces.Editable = true; ClearPlaces.SetCustomAccessors((_p_) => { return(((__Autocomp__)_p_).__bf__ClearPlaces__); }, (_p_, _v_) => { ((__Autocomp__)_p_).__bf__ClearPlaces__ = (System.Int64)_v_; }, false); ClearPlaces.AddHandler((Json pup, Property <Int64> prop, Int64 value) => { return(new Input.ClearPlaces() { App = (AutocompletePage)pup, Template = (TLong)prop, Value = value }); }, (Json pup, Starcounter.Input <Int64> input) => { ((AutocompletePage)pup).Handle((Input.ClearPlaces)input); }); FoundPlaces = Add <__TArray__>("FoundPlaces"); FoundPlaces.SetCustomGetElementType((arr) => { return(__AuFoundPla__.DefaultTemplate); }); FoundPlaces.SetCustomAccessors((_p_) => { return(((__Autocomp__)_p_).__bf__FoundPlaces__); }, (_p_, _v_) => { ((__Autocomp__)_p_).__bf__FoundPlaces__ = (__Arr__)_v_; }, false); ProductsSearch = Add <__TString__>("ProductsSearch$"); ProductsSearch.DefaultValue = ""; ProductsSearch.Editable = true; ProductsSearch.SetCustomAccessors((_p_) => { return(((__Autocomp__)_p_).__bf__ProductsSearch__); }, (_p_, _v_) => { ((__Autocomp__)_p_).__bf__ProductsSearch__ = (System.String)_v_; }, false); ProductsSearch.AddHandler((Json pup, Property <String> prop, String value) => { return(new Input.ProductsSearch() { App = (AutocompletePage)pup, Template = (TString)prop, Value = value }); }, (Json pup, Starcounter.Input <String> input) => { ((AutocompletePage)pup).Handle((Input.ProductsSearch)input); }); ProductsText = Add <__TString__>("ProductsText"); ProductsText.DefaultValue = ""; ProductsText.SetCustomAccessors((_p_) => { return(((__Autocomp__)_p_).__bf__ProductsText__); }, (_p_, _v_) => { ((__Autocomp__)_p_).__bf__ProductsText__ = (System.String)_v_; }, false); ClearProducts = Add <__TLong__>("ClearProducts$"); ClearProducts.DefaultValue = 0L; ClearProducts.Editable = true; ClearProducts.SetCustomAccessors((_p_) => { return(((__Autocomp__)_p_).__bf__ClearProducts__); }, (_p_, _v_) => { ((__Autocomp__)_p_).__bf__ClearProducts__ = (System.Int64)_v_; }, false); ClearProducts.AddHandler((Json pup, Property <Int64> prop, Int64 value) => { return(new Input.ClearProducts() { App = (AutocompletePage)pup, Template = (TLong)prop, Value = value }); }, (Json pup, Starcounter.Input <Int64> input) => { ((AutocompletePage)pup).Handle((Input.ClearProducts)input); }); FoundProducts = Add <__TArray1__>("FoundProducts"); FoundProducts.SetCustomGetElementType((arr) => { return(__AuFoundPro__.DefaultTemplate); }); FoundProducts.SetCustomAccessors((_p_) => { return(((__Autocomp__)_p_).__bf__FoundProducts__); }, (_p_, _v_) => { ((__Autocomp__)_p_).__bf__FoundProducts__ = (__Arr1__)_v_; }, false); }
public ActionResult Search() { var dating = new PlacesSearch(); if (CurrentUser != null) { dating.TownID = CurrentUser.TownID; } dating.Search(DB); return(PartialView(dating)); }
public async Task <object> Get([FromBody] PlacesSearch place) { using (var client = new HttpClient()) { //input google maps & replace the location using their current lat/long var response = await client.GetStringAsync(string.Format($"https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=-33.8670522,151.1957362&radius=100000&type=restaurant&keyword={place.Search}&key=AIzaSyC8XRhhuR8S3zMFfYlQX26kyzUewoccP-Q")); var result = JsonConvert.DeserializeObject(response); return(result); } }
private async void DefaultLocation_SuggestionChosen(AutoSuggestBox sender, AutoSuggestBoxSuggestionChosenEventArgs args) { if (args.SelectedItem != null) { var selected = args.SelectedItem as SinglePlace; var result = (await PlacesSearch.PlaceDetails(selected.PlaceId)); PlaceInfo _PlaceInfo = new PlaceInfo() { Latitude = result.result.geometry.location.lat, Longitude = result.result.geometry.location.lng, DisplayName = result.result.FormmatedName, PlaceId = selected.PlaceId }; ChoosenPlace = _PlaceInfo; } }
private async void CitiesSearch_QuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args) { if (args.ChosenSuggestion != null) { var selected = args.ChosenSuggestion as SinglePlace; var result = (await PlacesSearch.PlaceDetails(selected.PlaceId)); PlaceInfo _PlaceInfo = new PlaceInfo() { Latitude = result.result.geometry.location.lat, Longitude = result.result.geometry.location.lng, DisplayName = result.result.FormmatedName, PlaceId = selected.PlaceId }; Frame.Navigate(typeof(ShellPage), _PlaceInfo); } }
private async void DetectLocation_Click(object sender, RoutedEventArgs e) { LocationInfoStack.Visibility = Visibility.Visible; LocationInfoText.Text = "Locating Your device"; LocationProgress.Visibility = Visibility.Visible; var coords = await Geolocation.GetLocationInfo(); if (coords.Latitude == 0 && coords.Longitude == 0) { LocationProgress.Visibility = Visibility.Collapsed; LocationInfoText.Text = "Can't Locate You!"; } else { if (NetworkInformation.GetInternetConnectionProfile() != null) { var plid = await PlacesSearch.GetCityNameByCoordinate(coords.Latitude, coords.Longitude); if (plid != null) { ChoosenPlace = new PlaceInfo() { Latitude = plid.Latitude, Longitude = plid.Longitude, DisplayName = plid.DisplayName, PlaceId = plid.PlaceId }; DefaultLocation.Text = plid.DisplayName; } else { LocationInfoText.Text = "Can't Locate You!"; } } else { LocationInfoText.Text = "Can't Locate You!"; } LocationInfoStack.Visibility = Visibility.Collapsed; } }
public ActionResult Search(PlacesSearch dating) { dating.Search(DB); return(PartialView(dating)); }
protected override async void OnNavigatedTo(NavigationEventArgs e) { Frame PageFrame = Window.Current.Content as Frame; if (PageFrame == null) { PageFrame = new Frame(); } var settings = await ApplicationData.Current.RoamingFolder.TryGetItemAsync("Settings.json") == null ? null : await UserDataHelper.GetSettings("Settings.json"); if (settings == null) { ApplicationLanguages.PrimaryLanguageOverride = "en"; DefaultFrame.Navigate(typeof(FirstUse)); LoadingControl.IsLoading = false; return; } string Language = settings.Language ?? "en"; ApplicationLanguages.PrimaryLanguageOverride = Language; bool IsConnected = NetworkInformation.GetInternetConnectionProfile() != null ? true : false; string TimeFormat = settings.DataFormat.TimeFormat == "24h" ? "H:mm" : "h:mmtt"; if (IsConnected == false && e.Parameter == null) { if (await ApplicationData.Current.LocalFolder.TryGetItemAsync("HomeWeather.json") == null) { NoInternetGrid.Visibility = Visibility.Visible; return; } _CityData = await UserDataHelper.GetSavedHomeWeather(); _CityData.IsLocalData = true; var _File = await ApplicationData.Current.LocalFolder.GetFileAsync("HomeWeather.json"); _CityData.LastUpdate = System.IO.File.GetLastWriteTime(_File.Path).ToString(TimeFormat); PageFrame.Navigate(typeof(WeatherPage), _CityData); return; } if (e.Parameter != null) { if (IsConnected == true) { _PlaceInfo = e.Parameter as PlaceInfo; _CityData = (await WeatherData.GetWeather(_PlaceInfo, settings.DataFormat, Language)); if (_CityData.Current.cod == 200) { _CityData.LastUpdate = DateTime.Now.ToLocalTime().ToString(TimeFormat); PageFrame.Navigate(typeof(WeatherPage), _CityData); return; } } NoInternetGrid.Visibility = Visibility.Visible; } else { if (settings.CheckLocation == 1) { var coords = await Geolocation.GetLocationInfo(); if (coords.Latitude == 0 && coords.Longitude == 0) { LoadingControl.IsLoading = false; NotFoundGrid.Visibility = Visibility.Visible; NotFoundText.Text = "Sorry! Can't locate you!"; NotFoudHint.Text = "You can try searching instead"; return; } else { var plid = await PlacesSearch.GetCityNameByCoordinate(coords.Latitude, coords.Longitude); if (plid != null) { _PlaceInfo = new PlaceInfo() { Latitude = plid.Latitude, Longitude = plid.Longitude, DisplayName = plid.DisplayName, PlaceId = plid.PlaceId }; } else { LoadingControl.IsLoading = false; NotFoundGrid.Visibility = Visibility.Visible; NotFoundText.Text = "Sorry! Can't locate you!"; NotFoudHint.Text = "You can try searching instead"; return; } } } else { _PlaceInfo = new PlaceInfo { Latitude = settings.DefaultLocation.Latitude, Longitude = settings.DefaultLocation.Longitude, DisplayName = settings.DefaultLocation.DisplayName, PlaceId = settings.DefaultLocation.PlaceId }; } _CityData = (await WeatherData.GetWeather(_PlaceInfo, settings.DataFormat, Language)); _CityData.LastUpdate = DateTime.Now.ToLocalTime().ToString(TimeFormat); bool _SaveData = await UserDataHelper.SaveHomeWeather(_CityData); PageFrame.Navigate(typeof(WeatherPage), _CityData); } LoadingControl.IsLoading = false; /*try * { * } * catch (Exception) * { * await new MessageDialog("Unexpected exception occurred: 7221252017").ShowAsync(); * }*/ }
public async Task <IActionResult> VotePlaces() { PlacesSearch placesSearch = await GetVotePlaces(null); return(View(placesSearch)); }