예제 #1
0
        /// <summary>
        /// if they hitt search button event, will search for what the user wants
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void Button_Tapped_Search(object sender, TappedRoutedEventArgs e)
        {
            //find out whether the fileter box is checked
            try
            {
                _searchWithFilter = (bool)FilterCheck.IsChecked;

                //get the location from a search input and set values in the location object
                MyLocation location = new MyLocation(_map, _mapLayer, this, _searchWithFilter, key);
                location._searcher = SearchInput.Text;
                location._radius = _changedRadius;

                //if searching with filter, find the filter value
                if (_searchWithFilter)
                {
                    //pick filter
                    location.findFilter(_filter);
                }

                //instantiate VM and call search by filter
                viewmodel = new VM(this);
                viewmodel.search(true, location);
            }
            catch(Exception ex)
            {
                //display exception
                var messageDialog = new MessageDialog(ex.Message);
                messageDialog.ShowAsync();
            }
        }
예제 #2
0
        /// <summary>
        /// This method is the intermediate layer for a poi search
        /// It determines which search to use an instantiates that object
        /// </summary>
        /// <param name="place">bool describing whether its a place search or not</param>
        /// <param name="location">the location given in the APP</param>
        public async void search(bool place, MyLocation location)
        {
            try
            {
                if (place)
                {
                    //this is the place search
                    IREST placeSearch = new PlaceSearch(location, _searchObj);
                    await placeSearch.performSearch();
                    fileText = _searchObj.searchOutput(placeSearch._poiResponse);
                }
                else
                {
                    //this is for all other searches
                    IREST locSearch = new LocationSearch(location, _searchObj);
                    await locSearch.performSearch();
                    fileText = _searchObj.searchOutput(locSearch._poiResponse);
                }
            }
            catch (Exception e)
            {
                var messageDialog = new MessageDialog(e.Message);

                messageDialog.ShowAsync();

            }
        }
예제 #3
0
        /// <summary>
        /// event for searching poi based on your own location from device
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void Button_Tapped_MyLoc(object sender, TappedRoutedEventArgs e)
        {
            try
            {
                //check if there isnt a Gelocator object, if there isnt instantiate the object
                if (gg == null)
                {
                    gg = new Geolocator();
                }

                //get position
                Geoposition position = await gg.GetGeopositionAsync();

                //fill out forms
                Latitude.Text = String.Format("LAT: {0}", position.Coordinate.Point.Position.Latitude.ToString());
                Longitude.Text = String.Format("LONG: {0}", position.Coordinate.Point.Position.Longitude.ToString());
                SearchInput.Text = String.Format("Source: {0} , Country: {1}", position.Coordinate.PositionSource.ToString(), position.CivicAddress.Country);

                _searchWithFilter = (bool)FilterCheck.IsChecked;

                MyLocation location = new MyLocation(_map, _mapLayer, this, _searchWithFilter, key);

                //set Location OBJ LAt and Long
                location._radius = _changedRadius;
                location._latitude = position.Coordinate.Point.Position.Latitude;
                location._longitude = position.Coordinate.Point.Position.Longitude;

                if (_searchWithFilter)
                {
                    //pick filter
                    location.findFilter(_filter);
                }

                //start search just by loc only
                viewmodel = new VM(this);
                viewmodel.search(false, location);
            }
            catch(Exception ex)
            {
                var messageDialog = new MessageDialog(ex.Message);
                messageDialog.ShowAsync();
            }
        }
예제 #4
0
        /// <summary>
        /// will search based off of longitude and latitude
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void Button_Tapped_Loc(object sender, TappedRoutedEventArgs e)
        {
            try
            {
                _searchWithFilter = (bool)FilterCheck.IsChecked;
                MyLocation location = new MyLocation(_map, _mapLayer, this, _searchWithFilter, key);

                //set values using the given lat AND  long
                location._radius = _changedRadius;
                location._latitude = Convert.ToDouble(Latitude.Text);
                location._longitude = Convert.ToDouble(Longitude.Text);

                if (_searchWithFilter)
                {
                    //pick filter
                    location.findFilter(_filter);
                }

                //search just by loc
                viewmodel = new VM(this);
                viewmodel.search(false, location);
            }
            catch(Exception ex)
            {
                //display exception
                var messageDialog = new MessageDialog(ex.Message);
                messageDialog.ShowAsync();
            }
        }
예제 #5
0
 public LocationSearch(MyLocation loc, Search search)
 {
     _searches = search;
     _location = loc;
 }