コード例 #1
0
        // Constructor
        public LocationSelectorPage()
        {
            InitializeComponent();

            markerLayer = new MapLayer();
            map1.Layers.Add(markerLayer);

            geoQ = new GeocodeQuery();
            geoQ.QueryCompleted += geoQ_QueryCompleted;
            Debug.WriteLine("All construction done for GeoCoding");

            System.Windows.Input.Touch.FrameReported += Touch_FrameReported;

            map1.Tap += map1_Tap;
            map1.ZoomLevelChanged += map1_ZoomLevelChanged;

            resultList.SelectionChanged += resultList_SelectionChanged;

            watcher = new GeoCoordinateWatcher(GeoPositionAccuracy.Default);
            watcher.MovementThreshold = 20; // 20 meters

            watcher.StatusChanged   += new EventHandler <GeoPositionStatusChangedEventArgs>(OnStatusChanged);
            watcher.PositionChanged += new EventHandler <GeoPositionChangedEventArgs <GeoCoordinate> >(OnPositionChanged);

            watcher.Start();
        }
コード例 #2
0
 public LocationSearchResultListPage()
 {
     InitializeComponent();
     geoQ = new GeocodeQuery();
     geoQ.QueryCompleted += geoQ_QueryCompleted;
     Debug.WriteLine("All construction done for GeoCoding");
 }
コード例 #3
0
        // Constructor
        public LocationSelectorPage()
        {
            InitializeComponent();

            markerLayer = new MapLayer();
            map1.Layers.Add(markerLayer);

            geoQ = new GeocodeQuery();
            geoQ.QueryCompleted += geoQ_QueryCompleted;
            Debug.WriteLine("All construction done for GeoCoding");

            System.Windows.Input.Touch.FrameReported += Touch_FrameReported;

            map1.Tap += map1_Tap;
            map1.ZoomLevelChanged += map1_ZoomLevelChanged;

            resultList.SelectionChanged += resultList_SelectionChanged;

            watcher = new GeoCoordinateWatcher(GeoPositionAccuracy.Default);
            watcher.MovementThreshold = 20; // 20 meters

            watcher.StatusChanged += new EventHandler<GeoPositionStatusChangedEventArgs>(OnStatusChanged);
            watcher.PositionChanged += new EventHandler<GeoPositionChangedEventArgs<GeoCoordinate>>(OnPositionChanged);

            watcher.Start();
        }
コード例 #4
0
        private async void GetCoordinates()
        {
            // Get the phone's current location.
            Geolocator MyGeolocator = new Geolocator();
            MyGeolocator.DesiredAccuracyInMeters = 5;
            Geoposition MyGeoPosition = null;
            try
            {
                MyGeoPosition = await MyGeolocator.GetGeopositionAsync(TimeSpan.FromMinutes(1), TimeSpan.FromSeconds(10));
                MyCoordinates.Add(new GeoCoordinate(MyGeoPosition.Coordinate.Latitude, MyGeoPosition.Coordinate.Longitude));
                Debug.WriteLine(MyGeoPosition.Coordinate.Latitude + " " + MyGeoPosition.Coordinate.Longitude);

                Mygeocodequery = new GeocodeQuery();
                Mygeocodequery.SearchTerm = "Hanoi, VN";
                Mygeocodequery.GeoCoordinate = new GeoCoordinate(MyGeoPosition.Coordinate.Latitude, MyGeoPosition.Coordinate.Longitude);

                Mygeocodequery.QueryCompleted += Mygeocodequery_QueryCompleted;
                Mygeocodequery.QueryAsync();

            }
            catch (UnauthorizedAccessException)
            {
                MessageBox.Show("Location is disabled in phone settings or capabilities are not checked.");
            }
            catch (Exception ex)
            {
                // Something else happened while acquiring the location.
                MessageBox.Show(ex.Message);
            }
        }
コード例 #5
0
        private void GetCoordinates()//private async void GetCoordinates()
        {
            // Get the phone's current location.
            //Geolocator MyGeolocator = new Geolocator();
            //MyGeolocator.DesiredAccuracyInMeters = 5;
            //Geoposition MyGeoPosition = null;
            try
            {
                //MyGeoPosition = await MyGeolocator.GetGeopositionAsync(TimeSpan.FromMinutes(1), TimeSpan.FromSeconds(10));
                MyCoordinates.Add(liveCoor);//new GeoCoordinate(MyGeoPosition.Coordinate.Latitude, MyGeoPosition.Coordinate.Longitude));

                Mygeocodequery               = new GeocodeQuery();
                Mygeocodequery.SearchTerm    = VENUE_LAT + ", " + VENUE_LONG;
                Mygeocodequery.GeoCoordinate = liveCoor;//new GeoCoordinate(MyGeoPosition.Coordinate.Latitude, MyGeoPosition.Coordinate.Longitude);

                Mygeocodequery.QueryCompleted += Mygeocodequery_QueryCompleted;
                Mygeocodequery.QueryAsync();
            }
            catch (UnauthorizedAccessException)
            {
                MessageBox.Show("Location is disabled in phone settings or capabilities are not checked.");
            }
            catch (Exception ex)
            {
                // Something else happened while acquiring the location.
                MessageBox.Show(ex.Message);
            }
        }
コード例 #6
0
 private void SearchForTerm(String searchTerm)
 {
     var MyGeocodeQuery = new GeocodeQuery();
     MyGeocodeQuery.SearchTerm = searchTerm;
     MyGeocodeQuery.GeoCoordinate = new GeoCoordinate(-6.9148640, 107.6082420);
     MyGeocodeQuery.QueryCompleted += GeocodeQuery_QueryCompleted;
     MyGeocodeQuery.QueryAsync();
 }
コード例 #7
0
 private void SearchForTerm(String searchTerm)
 {
     MyGeocodeQuery = new GeocodeQuery();
     MyGeocodeQuery.SearchTerm = searchTerm;
     MyGeocodeQuery.GeoCoordinate = MyCoordinate == null ? new GeoCoordinate(0, 0) : MyCoordinate;
     MyGeocodeQuery.QueryCompleted += GeocodeQuery_QueryCompleted;
     MyGeocodeQuery.QueryAsync();
 }
コード例 #8
0
 private void SearchForTerm(String searchTerm)
 {
     MyGeocodeQuery                 = new GeocodeQuery();
     MyGeocodeQuery.SearchTerm      = searchTerm;
     MyGeocodeQuery.GeoCoordinate   = MyCoordinate == null ? new GeoCoordinate(0, 0) : MyCoordinate;
     MyGeocodeQuery.QueryCompleted += GeocodeQuery_QueryCompleted;
     MyGeocodeQuery.QueryAsync();
 }
コード例 #9
0
ファイル: PinLocation.xaml.cs プロジェクト: khantil/LBSToDo
        // Constructor
        public PinLocation()
        {
            InitializeComponent();

            geoQ = new GeocodeQuery();
            geoQ.QueryCompleted += geoQ_QueryCompleted;
            Debug.WriteLine("All construction done for GeoCoding");
        }
コード例 #10
0
 private void route_Click(object sender, EventArgs e)
 {
     Mygeocodequery                 = new GeocodeQuery();
     Mygeocodequery.SearchTerm      = "хмельницький зарічанська 10";
     Mygeocodequery.GeoCoordinate   = new GeoCoordinate(46.202215, 25.020216);
     Mygeocodequery.QueryCompleted += Mygeocodequery_QueryCompleted;
     Mygeocodequery.QueryAsync();
 }
コード例 #11
0
        // Constructor
        public MainPage()
        {
            InitializeComponent();

            geoQ = new GeocodeQuery();
            geoQ.QueryCompleted += geoQ_QueryCompleted;
            Debug.WriteLine("All construction done for GeoCoding");
        }
コード例 #12
0
        static public void MapPosition(string address)
        {
            var geoQ = new GeocodeQuery();

            geoQ.GeoCoordinate = new GeoCoordinate(0, 0);
            geoQ.SearchTerm = address;
            geoQ.QueryCompleted += GeoQ_MapPositionQueryCompleted;
            geoQ.QueryAsync();
        }
コード例 #13
0
        static public void HowToGet(string address)
        {
            var geoQ = new GeocodeQuery();

            geoQ.GeoCoordinate = new GeoCoordinate(0, 0);
            geoQ.SearchTerm = address;
            geoQ.QueryCompleted += GeoQ_HowToGetQueryCompleted;
            geoQ.QueryAsync();
        }
コード例 #14
0
 /// <summary>
 /// Method to initiate a geocode query for a search term.
 /// </summary>
 /// <param name="searchTerm">Search term for location or destination</param>
 private void SearchForTerm(String searchTerm)
 {
     ShowProgressIndicator(AppResources.SearchingProgressText);
     MyGeocodeQuery                 = new GeocodeQuery();
     MyGeocodeQuery.SearchTerm      = searchTerm;
     MyGeocodeQuery.GeoCoordinate   = MyCoordinate == null ? new GeoCoordinate(0, 0) : MyCoordinate;
     MyGeocodeQuery.QueryCompleted += GeocodeQuery_QueryCompleted;
     MyGeocodeQuery.QueryAsync();
 }
コード例 #15
0
        static public void MapPosition(string address)
        {
            var geoQ = new GeocodeQuery();

            geoQ.GeoCoordinate   = new GeoCoordinate(0, 0);
            geoQ.SearchTerm      = address;
            geoQ.QueryCompleted += GeoQ_MapPositionQueryCompleted;
            geoQ.QueryAsync();
        }
コード例 #16
0
        static public void HowToGet(string address)
        {
            var geoQ = new GeocodeQuery();

            geoQ.GeoCoordinate   = new GeoCoordinate(0, 0);
            geoQ.SearchTerm      = address;
            geoQ.QueryCompleted += GeoQ_HowToGetQueryCompleted;
            geoQ.QueryAsync();
        }
コード例 #17
0
        private void btRoute_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            coordonnesTrajet.Add(positionUser);
            Mygeocodequery = new GeocodeQuery();
            Mygeocodequery.SearchTerm = oneStationDetails.Wcom + " , Alpes-Maritimes";
            Mygeocodequery.GeoCoordinate = posStation;

            Mygeocodequery.QueryCompleted += Mygeocodequery_QueryCompleted;
            Mygeocodequery.QueryAsync();
        }
コード例 #18
0
        private void AfficherCarte(PhoneTextBox myTextBox, Microsoft.Phone.Maps.Controls.Map myMap)
        {
            GeocodeQuery query = new GeocodeQuery()
            {
                GeoCoordinate = new GeoCoordinate(0, 0),
                SearchTerm    = myTextBox.Text
            };

            query.QueryCompleted += query_QueryCompleted;
            query.QueryAsync();
        }
コード例 #19
0
        public async void Cadastrar()
        {
            DateTime?_datetime = time_abre.Value;
            string   hr_abre   = _datetime.Value.Hour + ":" + _datetime.Value.Minute;

            _datetime = time_fecha.Value;
            string hr_fecha = _datetime.Value.Hour + ":" + _datetime.Value.Minute;

            ListPickerItem selectedItem = (ListPickerItem)lst_segmento.SelectedItem;
            string         segmento_lst = (string)selectedItem.Content;

            ParseObject cadastro = new ParseObject("Foodtruck");

            try {
                cadastro["idUser"]         = Id;
                cadastro["Foodtruck_nome"] = txt_foodtruck_nome.Text;
                cadastro["Segmento"]       = segmento_lst;
                cadastro["Hr_abre"]        = hr_abre;
                cadastro["Hr_Fecha"]       = hr_fecha;
                cadastro["Preco"]          = txt_preco.Text;
                cadastro["Telefone"]       = txt_telefone.Text;

                GeocodeQuery geocodeQuery = new GeocodeQuery();
                geocodeQuery.GeoCoordinate = new GeoCoordinate();
                geocodeQuery.SearchTerm    = txt_local.Text;

                IList <MapLocation> locations = await geocodeQuery.GetMapLocationsAsync();

                foreach (var local in locations)
                {
                    var point = new ParseGeoPoint(local.GeoCoordinate.Latitude, local.GeoCoordinate.Longitude);
                    cadastro["localizacao"] = point;
                    MessageBoxResult resultado6 = MessageBox.Show("latitude: " + point.Latitude + " longitude: " + point.Longitude, "Foodtruck Show", MessageBoxButton.OK);
                }
                await
                cadastro.SaveAsync();
            }
            catch (Exception ex) {
                MessageBox.Show("Erro: " + ex);
            }

            MessageBoxResult resultado0 = MessageBox.Show("ID : " + Id, "Foodtruck Show", MessageBoxButton.OK);
            MessageBoxResult resultado1 = MessageBox.Show("Nome : " + txt_foodtruck_nome.Text, "Foodtruck Show", MessageBoxButton.OK);
            MessageBoxResult resultado2 = MessageBox.Show("Segmento : " + segmento_lst, "Foodtruck Show", MessageBoxButton.OK);
            MessageBoxResult resultado3 = MessageBox.Show(hr_abre + " " + hr_fecha, "Foodtruck Show", MessageBoxButton.OK);
            MessageBoxResult resultado4 = MessageBox.Show("Preco : " + txt_preco.Text, "Foodtruck Show", MessageBoxButton.OK);
            MessageBoxResult resultado5 = MessageBox.Show("tel : " + txt_telefone.Text, "Foodtruck Show", MessageBoxButton.OK);
            MessageBoxResult resultado  = MessageBox.Show("Informacoes cadastradas com sucesso", "Foodtruck Show", MessageBoxButton.OK);

            if (resultado == MessageBoxResult.OK)
            {
                NavigationService.GoBack();
            }
        }
コード例 #20
0
ファイル: MainPage.xaml.cs プロジェクト: mbcrump/Maps
        public void GeoCoding_Click(object sender, EventArgs e)
        {
            GeocodeQuery query = new GeocodeQuery()
            {
                GeoCoordinate = new GeoCoordinate(0, 0),
                SearchTerm    = "Vulcan, Alabama"
            };

            query.QueryCompleted += query_QueryCompleted;
            query.QueryAsync();
        }
コード例 #21
0
        private void BuscarPorEndereco(string logradouro, string cidade)
        {
            GeocodeQuery pesquisa = new GeocodeQuery();

            pesquisa.MaxResultCount  = 1;
            pesquisa.SearchTerm      = string.Concat(logradouro, ", ", cidade);
            pesquisa.GeoCoordinate   = new GeoCoordinate(0, 0);
            pesquisa.QueryCompleted += pesquisa_QueryCompleted;
            pesquisa.QueryAsync();

            Logradouro.Text = string.Empty;
            Cidade.Text     = string.Empty;
        }
コード例 #22
0
        public async void Cadastrar()
        {
            DateTime? _datetime = time_abre.Value;
            string hr_abre = _datetime.Value.Hour + ":" + _datetime.Value.Minute;
            
            _datetime = time_fecha.Value;
            string hr_fecha = _datetime.Value.Hour + ":" + _datetime.Value.Minute;

            ListPickerItem selectedItem = (ListPickerItem)lst_segmento.SelectedItem;
            string segmento_lst = (string)selectedItem.Content;
            
            ParseObject cadastro = new ParseObject("Foodtruck");
            try {
                cadastro["idUser"] = Id;
                cadastro["Foodtruck_nome"] = txt_foodtruck_nome.Text;
                cadastro["Segmento"] = segmento_lst;
                cadastro["Hr_abre"] = hr_abre;
                cadastro["Hr_Fecha"] = hr_fecha;
                cadastro["Preco"] = txt_preco.Text;
                cadastro["Telefone"] = txt_telefone.Text;

                GeocodeQuery geocodeQuery = new GeocodeQuery();
                geocodeQuery.GeoCoordinate = new GeoCoordinate();
                geocodeQuery.SearchTerm = txt_local.Text;

                IList<MapLocation> locations = await geocodeQuery.GetMapLocationsAsync();

                foreach (var local in locations)
                {        
                    var point = new ParseGeoPoint(local.GeoCoordinate.Latitude, local.GeoCoordinate.Longitude);
                    cadastro["localizacao"] = point;
                    MessageBoxResult resultado6 = MessageBox.Show("latitude: " + point.Latitude+" longitude: "+ point.Longitude, "Foodtruck Show", MessageBoxButton.OK); 
                }                
                await
                     cadastro.SaveAsync();
            }
            catch (Exception ex) {
                MessageBox.Show("Erro: " + ex);
            }

            MessageBoxResult resultado0 = MessageBox.Show("ID : " + Id, "Foodtruck Show", MessageBoxButton.OK);
            MessageBoxResult resultado1 = MessageBox.Show("Nome : " +txt_foodtruck_nome.Text, "Foodtruck Show", MessageBoxButton.OK);
            MessageBoxResult resultado2 = MessageBox.Show("Segmento : " + segmento_lst, "Foodtruck Show", MessageBoxButton.OK);
            MessageBoxResult resultado3 = MessageBox.Show(hr_abre + " " + hr_fecha , "Foodtruck Show", MessageBoxButton.OK);
            MessageBoxResult resultado4 = MessageBox.Show("Preco : "+ txt_preco.Text, "Foodtruck Show", MessageBoxButton.OK);
            MessageBoxResult resultado5 = MessageBox.Show("tel : "+ txt_telefone.Text, "Foodtruck Show", MessageBoxButton.OK);
            MessageBoxResult resultado = MessageBox.Show("Informacoes cadastradas com sucesso", "Foodtruck Show", MessageBoxButton.OK);

            if (resultado == MessageBoxResult.OK)
                NavigationService.GoBack();
        }
コード例 #23
0
        //String[] listStatusArray = { "Choose Status", "Orphan", "Orphans", "Poor children" };

        public PageRekomendasi()
        {
            InitializeComponent();
            this.DataContext = new ViewModelRekomendasi();
            //this.listStatus.ItemsSource = listStatusArray;

            pivot2.Visibility = Visibility.Collapsed;
            pivot1.Visibility = Visibility.Visible;
            
            geoQ = new GeocodeQuery();
            geoQ.QueryCompleted += geoQ_QueryCompleted;
            Debug.WriteLine("All construction done for GeoCoding");
            
        }
コード例 #24
0
        private void GetGeoCoordinate(object sender, QueryCompletedEventArgs <IList <MapLocation> > e)
        {
            StringBuilder sb = new StringBuilder();

            foreach (var item in e.Result)
            {
                MyMap.Center    = item.GeoCoordinate;
                MyMap.ZoomLevel = 16;
            }
            EnableAppButtons(true);
            getLocation.IconUri = new Uri("/Images/dark.cross.png", UriKind.Relative);
            getLocation.Text    = "Get Location";
            query = null;
        }
コード例 #25
0
ファイル: Page1.xaml.cs プロジェクト: scuh/WS6C
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     base.OnNavigatedTo(e);
     var customerId = string.Empty;
     if (NavigationContext.QueryString.TryGetValue("ID", out customerId))
     {
         App.CustomerUiService.SelectCustomer(Convert.ToInt32(customerId));
         DataContext = App.CustomerUiService.SelectedCustomer;
     }
     GeocodeQuery geoQuery = new GeocodeQuery();
     geoQuery.SearchTerm = App.CustomerUiService.SelectedCustomer.Country;
     geoQuery.GeoCoordinate = new GeoCoordinate(0, 0);
     geoQuery.QueryCompleted += setCountryPosition;
     geoQuery.QueryAsync();
 }
コード例 #26
0
        private async void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
        {
            ViewModelLocator.MainStatic.Loading = true;
            await ViewModelLocator.MainStatic.SearchItem.CurrentCustomerItem.LoadFullCustomerData();

            ViewModelLocator.MainStatic.Loading = false;

            await GetCoordinates();

            Mygeocodequery            = new GeocodeQuery();
            Mygeocodequery.SearchTerm = ViewModelLocator.MainStatic.SearchItem.CurrentCustomerItem.Details.PostalAddress;
            //Mygeocodequery.GeoCoordinate = new GeoCoordinate(MyGeoPosition.Coordinate.Latitude, MyGeoPosition.Coordinate.Longitude);
            Mygeocodequery.GeoCoordinate = new GeoCoordinate(0, 0);

            Mygeocodequery.QueryCompleted += Mygeocodequery_QueryCompleted;
            Mygeocodequery.QueryAsync();
        }
コード例 #27
0
        static Task <IEnumerable <Position> > GetPositionsForAddress(string s)
        {
            var source = new TaskCompletionSource <IEnumerable <Position> >();
            var query  = new GeocodeQuery
            {
                SearchTerm    = s,
                GeoCoordinate = new GeoCoordinate(PositionForGeocoding.Latitude, PositionForGeocoding.Longitude)
            };

            query.QueryCompleted +=
                (sender, args) =>
                source.SetResult(
                    args.Result.Select(r => new Position(r.GeoCoordinate.Latitude, r.GeoCoordinate.Longitude)).ToArray());
            query.QueryAsync();

            return(source.Task);
        }
コード例 #28
0
ファイル: Page1.xaml.cs プロジェクト: scuh/WS6C
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);
            var customerId = string.Empty;

            if (NavigationContext.QueryString.TryGetValue("ID", out customerId))
            {
                App.CustomerUiService.SelectCustomer(Convert.ToInt32(customerId));
                DataContext = App.CustomerUiService.SelectedCustomer;
            }
            GeocodeQuery geoQuery = new GeocodeQuery();

            geoQuery.SearchTerm      = App.CustomerUiService.SelectedCustomer.Country;
            geoQuery.GeoCoordinate   = new GeoCoordinate(0, 0);
            geoQuery.QueryCompleted += setCountryPosition;
            geoQuery.QueryAsync();
        }
コード例 #29
0
        /// <summary>
        /// Method to get directions
        /// </summary>
        private void GetDirections()
        {
            string searchTerm = string.Concat(App.LoginPharmacyAddress1 + ", " + App.LoginPharmacyAddress2 + ", " + App.PostCode + ", " + App.LoginPharmacyAddress3);

            if (Utilities.IsConnectedToNetwork())
            {
                mygeocodeQuery = new GeocodeQuery {
                    GeoCoordinate = new GeoCoordinate(0, 0), SearchTerm = searchTerm
                };
                mygeocodeQuery.QueryCompleted += mygeocodeQuery_QueryCompleted;

                mygeocodeQuery.QueryAsync();
            }
            else
            {
                MessageBox.Show("No network found");
            }
        }
コード例 #30
0
ファイル: MainPage.xaml.cs プロジェクト: pjmatuck/QualDDD
 private void GetCoordinates()
 {
     try
     {
         geoQuery                 = new GeocodeQuery();
         geoQuery.SearchTerm      = location;
         geoQuery.GeoCoordinate   = new GeoCoordinate();
         geoQuery.QueryCompleted += geoQuery_QueryCompleted;
         geoQuery.QueryAsync();
     }
     catch (UnauthorizedAccessException)
     {
         throw;
     }
     catch (Exception)
     {
         // Something else happened while acquiring the location.
         throw;
     }
 }
コード例 #31
0
 private void Find(object sender, System.Windows.Input.KeyEventArgs e)
 {
     if (e.Key == Key.Enter)
     {
         if (Enabled)
         {
             EnableAppButtons(false);
             getLocation.Text      = "Stop";
             getLocation.IconUri   = new Uri("/Images/dark.transport.stop.png", UriKind.Relative);
             getLocation.IsEnabled = true;
             MyMap.Focus();
             query = new GeocodeQuery()
             {
                 GeoCoordinate = new GeoCoordinate(0, 0),
                 SearchTerm    = Search.Text
             };
             query.QueryCompleted += GetGeoCoordinate;
             query.QueryAsync();
         }
     }
 }
コード例 #32
0
        private void GetPhoneContactToMap()
        {
            rows = Db_Helper.TotalRows();

            for (int i = 1; i <= rows; i++)
            {

                currentcontact = Db_Helper.ReadContact(i);
                name.Text = currentcontact.Name;
                loc.Text = currentcontact.Location;

                contactlocation = loc.Text;
                contactname = name.Text;

                mysearchgeoquery = new GeocodeQuery();
                mysearchgeoquery.GeoCoordinate = new GeoCoordinate(MyGeoPosition.Coordinate.Latitude, MyGeoPosition.Coordinate.Longitude);
                mysearchgeoquery.SearchTerm = contactlocation;
                mysearchgeoquery.QueryCompleted += ContactNumberBinding_QueryCompleted;
                mysearchgeoquery.QueryAsync();
                sayingInfo(contactname);
            }
        }
コード例 #33
0
        public static void AddToMap(Map myMap, GeoCoordinate coord, TextBox textBox, bool reverse)
        {
            Query <System.Collections.Generic.IList <MapLocation> > query = null;

            if (reverse)
            {
                query = new ReverseGeocodeQuery()
                {
                    GeoCoordinate = coord,
                };
            }
            else
            {
                query = new GeocodeQuery()
                {
                    GeoCoordinate = new GeoCoordinate(0, 0),
                    SearchTerm    = textBox.Text
                };
            }
            query.QueryCompleted += query_QueryCompleted;
            query.QueryAsync();
        }
コード例 #34
0
        public static void AddToMap(Map myMap, GeoCoordinate coord, TextBox textBox, bool reverse)
        {
            Query<System.Collections.Generic.IList<MapLocation>> query = null;

            if (reverse)
            {
                query = new ReverseGeocodeQuery()
                {
                    GeoCoordinate = coord,
                };
            }
            else
            {
                query = new GeocodeQuery()
                {
                    GeoCoordinate = new GeoCoordinate(0, 0),
                    SearchTerm = textBox.Text
                };
            }
            query.QueryCompleted += query_QueryCompleted;
            query.QueryAsync();
        }
コード例 #35
0
        private async void GetLocation(object sender, EventArgs e)
        {
            if (Enabled)
            {
                EnableAppButtons(false);
                getLocation.Text      = "Stop";
                getLocation.IconUri   = new Uri("/Images/dark.transport.stop.png", UriKind.Relative);
                getLocation.IsEnabled = true;

                Geolocator myGeolocator = new Geolocator();
                locationTask = myGeolocator.GetGeopositionAsync();
                Geoposition   myGeoposition   = await locationTask;
                Geocoordinate myGeocoordinate = myGeoposition.Coordinate;
                GeoCoordinate myGeoCoordinate = CoordinateConverter.ConvertGeocoordinate(myGeocoordinate);
                MyMap.Center    = myGeoCoordinate;
                MyMap.ZoomLevel = 13;

                getLocation.IconUri = new Uri("/Images/dark.cross.png", UriKind.Relative);
                getLocation.Text    = "Get Location";
                EnableAppButtons(true);
            }
            else
            {
                if (query != null)
                {
                    query.CancelAsync();
                    query = null;
                }
                else
                {
                    locationTask.Cancel();
                }
                getLocation.IconUri = new Uri("/Images/dark.cross.png", UriKind.Relative);
                getLocation.Text    = "Get Location";
                EnableAppButtons(true);
            }
        }
コード例 #36
0
 void appBarMenuItem_Click(object sender, EventArgs e)
 {
     if (currentGeoCoordinate != null)
     {
         GeocodeQuery geocodeQuery = new GeocodeQuery();
         geocodeQuery.SearchTerm = "北京";
         geocodeQuery.GeoCoordinate = currentGeoCoordinate;
         geocodeQuery.QueryCompleted += geocodeQuery_QueryCompleted;
         geocodeQuery.QueryAsync();
     }
 }
コード例 #37
0
 private void menuRota_Click(object sender, RoutedEventArgs e)
 {
     _clienteSelecionado = GetCliente((string) (sender as MenuItem).Tag);
     GeocodeQuery query = new GeocodeQuery()
     {
         SearchTerm = _clienteSelecionado.Endereco,
         GeoCoordinate = new System.Device.Location.GeoCoordinate()
     };
     query.QueryCompleted += Query_QueryCompleted;
     query.QueryAsync();
 }
コード例 #38
0
        /// <summary>
        /// Method to get directions
        /// </summary>
        private void GetDirections()
        {
            string searchTerm = string.Concat(App.LoginPharmacyAddress1 + ", " + App.LoginPharmacyAddress2 + ", " + App.PostCode + ", " + App.LoginPharmacyAddress3);

            if (Utilities.IsConnectedToNetwork())
            {
                mygeocodeQuery = new GeocodeQuery { GeoCoordinate = new GeoCoordinate(0, 0), SearchTerm = searchTerm };
                mygeocodeQuery.QueryCompleted += mygeocodeQuery_QueryCompleted;

                mygeocodeQuery.QueryAsync();
            }
            else
            {
                MessageBox.Show("No network found");
            }
        }
コード例 #39
0
ファイル: MapView.xaml.cs プロジェクト: sumithpdd/Landmark
 /// <summary>
 /// Method to initiate a geocode query for a search term.
 /// </summary>
 /// <param name="searchTerm">Search term for location or destination</param>
 private void SearchForTerm(String searchTerm)
 {
     ShowProgressIndicator(AppResources.SearchingProgressText);
     MyGeocodeQuery = new GeocodeQuery();
     MyGeocodeQuery.SearchTerm = searchTerm;
     MyGeocodeQuery.GeoCoordinate = MyCoordinate == null ? new GeoCoordinate(0, 0) : MyCoordinate;
     MyGeocodeQuery.QueryCompleted += GeocodeQuery_QueryCompleted;
     MyGeocodeQuery.QueryAsync();
 }
コード例 #40
0
 /*
  * Функция, запускающая процесс поиска по заданному фрагменту строки
  */
 private void SearchForTerm(string term)
 {
     SetProgressIndicatiorVisibility(true, AppResources.ProgressIndicatorSearchTermText);
     searchQuery = new GeocodeQuery();
     searchQuery.SearchTerm = term;
     searchQuery.GeoCoordinate = myMapMarker.Coordinate == null ? new GeoCoordinate(0, 0) : myMapMarker.Coordinate;
     searchQuery.QueryCompleted += searchQuery_QueryCompleted;
     searchQuery.QueryAsync();
 }
コード例 #41
0
ファイル: CitySelect.xaml.cs プロジェクト: TVZmc2/ErasmusWP
        /// <summary>
        /// Finds geocoordinates based on the search term
        /// </summary>
        /// <param name="searchTerm"></param>
        private void FindGeoCoordinates(string searchTerm)
        {
            GeocodeQuery query = new GeocodeQuery()
            {
                GeoCoordinate = new System.Device.Location.GeoCoordinate(0, 0),
                SearchTerm = searchTerm
            };

            query.QueryCompleted += query_QueryCompleted;
            query.QueryAsync();
        }
コード例 #42
0
        /// <summary>
        /// Hàm này để đặt lại mọi trạng thái điều kiện
        /// </summary>
        private void ResetFlag()
        {
            //For Router        
            driverGeocodeQuery = null;
            driverQuery = null;
            driverMapRoute = null;
            driverRoute = null;

            //For get Current Location
            driverFirstGeolocator = null;
            driverFirstGeoposition = null;
            driverMapOverlay = null;
            driverMapLayer = null;

            //For Router        
            driverGeocodeQuery = null;
            driverQuery = null;
            driverMapRoute = null;
            driverRoute = null;

            //For get Current Location
            driverFirstGeolocator = null;
            driverFirstGeoposition = null;
            driverMapOverlay = null;
            driverMapLayer = null;

            //Rider Destination Icon Overlay
            driverDestinationIconOverlay = null;

            //For Update Current Location
            currentLat = 0;
            currentLng = 0;
            countForUpdateLocation = 0;

            //For trip
            newTrip = null;
            myTrip = null;

            //For Trip Complete
            startLatitude = 0;
            startLongitude = 0;
            endLatitude = 0;
            endLongitude = 0;
            isTrack = false;
            estimateCost = 0;
            totalFare = 0;

            //For Distance
            distanceKm = 0;

            //mySelectedVehicle = null;
            if (tNetTripData != null)
            {
                tNetTripData = null;
            }

            //for complete trip
            completeTrip = null;

            //For continous tracking on map
            fiveStepBeforeLat = 0;
            fiveStepBeforeLng = 0;
            fiveStepAfterLat = 0;
            fiveStepAfterLng = 0;
            //driverMapTrackerQuery = null;
            //driverMapTrackerRoute = null;
            isTrackingRoute = false;
            countTracking = 0;
            //driverMapTrakerLayer = null;
            //driverMapTrackerOverlay = null;

            isCalculateFare = false;

            realDistance = 0;
            realFare = 0;
            isFinishTrip = false;

            isTrakingStated = false;

            txt_DistanceKm.Text = "0.0 (km)";
            txt_PricePerDistance.Text = "0.000 (đ)";
            txt_TotalPrice.Text = "0.000 (đ)";            
        }
コード例 #43
0
 private void SearchButton_Click(object sender, RoutedEventArgs e)
 {
     if (isDestinationSearched) // quick fix for restarting search
     {
         Mygeocodequery = null;
         MyQuery = null;
         getDestination();
     }
     else
     {
         getDestination(); // produces a route to the destination (pretty quickly)
     }
     isDestinationBoxFirstClick = false;
 }
コード例 #44
0
ファイル: MainPage.xaml.cs プロジェクト: bendata61/anyplace
        private void LocationSearch(GeoCoordinate coordinates)
        {
            GeoCoordinate g = new GeoCoordinate();

            if (_externalSource)
                g = _externalCoordinates;
            else
            {
                g = new GeoCoordinate(_myLatitude, _myLongitude);
            }

            _myGeocodeQuery = new GeocodeQuery
            {
                SearchTerm = coordinates.ToString(),
                GeoCoordinate = g
            };
            _myGeocodeQuery.QueryCompleted += SearchQueryCompleted;
            _myGeocodeQuery.QueryAsync();
        }
コード例 #45
0
ファイル: MainPage.xaml.cs プロジェクト: bendata61/anyplace
 private void getSearchLocation(GeoCoordinate location)
 {
     _mygeocodequerylocation = new GeocodeQuery
     {
         SearchTerm = location.ToString(),
         GeoCoordinate = new GeoCoordinate(_myLatitude, _myLongitude)
     };
     _mygeocodequerylocation.QueryCompleted += MygeocodequerylocationSearch_QueryCompleted;
     _mygeocodequerylocation.QueryAsync();
 }
コード例 #46
0
ファイル: MainPage.xaml.cs プロジェクト: bendata61/anyplace
        private async void GetNavigationRoutesPoiToPoi(string poi_from, string poi_to, GeoCoordinate floorPoiLocation)
        {
            try
            {
                var isNetwork = NetworkInterface.GetIsNetworkAvailable();
                if (isNetwork)
                {
                    if (!poi_from.Equals(poi_to))
                        _routePoi = await CustomPushpinWp8APIClient.GetPoiToPoiRoute(poi_from, poi_to);
                }
                else
                {
                    MessageBox.Show("No internet connection found. Check your internet connection and try again!");
                    directions_grid.Visibility = Visibility.Collapsed;
                    stackpanelClose();
                    MoveViewWindow(30);
                    ApplicationBar.IsVisible = true;
                    return;
                }
                _getIndoornav = true;
                _selectedFloor = _floorPoiFromNumber;

                Dispatcher.BeginInvoke(() =>
                {
                    txt_cur.Text = _selectedFloor;
                });

                ChangeFloor();
                if (!poi_from.Equals(poi_to))
                    GetRouteOfTheCurrentFloor();
                // clear route details
                if (Mymap.Layers.Contains(routedetails_layer))
                    Mymap.Layers.Remove(routedetails_layer);

                // clear directions
                if (GetRoute.Count != 0)
                {
                    GetRoute.Clear();
                    if (_myMapRoute != null)
                        Mymap.RemoveRoute(_myMapRoute);
                }
                var g = new GeoCoordinate();
                // set phone current location
                if (!_externalSource)
                {
                    g.Latitude = _myLatitude;
                    g.Longitude = _myLongitude;
                }
                else
                {
                    g.Latitude = _externalCoordinates.Latitude;
                    g.Longitude = _externalCoordinates.Longitude;
                }

                GetRoute.Add(g);
                _mygeocodequery = new GeocodeQuery
                {
                    SearchTerm = floorPoiLocation.ToString(),
                    GeoCoordinate = g
                };
                _mygeocodequery.QueryCompleted += MygeocodequeryPoiSearch_QueryCompleted;
                _mygeocodequery.QueryAsync();

            }
            catch
            {
                directions_grid.Visibility = Visibility.Collapsed;
                stackpanelClose();
                MoveViewWindow(30);
                if (directions_grid.Visibility != Visibility.Visible)
                    ApplicationBar.IsVisible = true;
                if (_routePoi.message.Contains("same"))
                    MessageBox.Show(_routePoi.message);
                else
                    MessageBox.Show("Can not get navigation route inside building. Please check your internet connection!");
            }
        }
コード例 #47
0
 public static Task <IList <MapLocation> > GetMapLocationsAsync(this GeocodeQuery geocodeQuery)
 {
     return(QueryAsync <IList <MapLocation> >(geocodeQuery));
 }
コード例 #48
0
        private void BuscarPorEndereco(string logradouro, string cidade)
        {
            GeocodeQuery pesquisa = new GeocodeQuery();
            pesquisa.MaxResultCount = 1;
            pesquisa.SearchTerm = string.Concat(logradouro, ", ", cidade);
            pesquisa.GeoCoordinate = new GeoCoordinate(0, 0);
            pesquisa.QueryCompleted += pesquisa_QueryCompleted;
            pesquisa.QueryAsync();

            Logradouro.Text = string.Empty;
            Cidade.Text = string.Empty;
        }
コード例 #49
0
        private void Button_Click(object sender, RoutedEventArgs e)//find nearest shelter and draw path to it
        {
            //find nearest
            shelters.Sort((Shelter s1, Shelter s2) =>
            {
                return Math.Sqrt(Math.Pow(s1.Coordinate.Latitude - userCoordinate.Latitude, 2) + Math.Pow(s1.Coordinate.Longitude - userCoordinate.Longitude, 2)).CompareTo(
                        Math.Sqrt(Math.Pow(s2.Coordinate.Latitude - userCoordinate.Latitude, 2) + Math.Pow(s2.Coordinate.Longitude - userCoordinate.Longitude, 2)));
            });
            nearest = shelters[0];
            alternative = shelters[1];
            Mygeocodequery = new GeocodeQuery();
            Mygeocodequery.SearchTerm = nearest.Adress;
            Mygeocodequery.GeoCoordinate = nearest.Coordinate;
            Mygeocodequery.QueryCompleted += Mygeocodequery_QueryCompleted;
            Mygeocodequery.QueryAsync();

            Mygeocodequery1 = new GeocodeQuery();
            Mygeocodequery1.SearchTerm = alternative.Adress;
            Mygeocodequery1.GeoCoordinate = alternative.Coordinate;
            Mygeocodequery1.QueryCompleted += Mygeocodequery_QueryCompleted1;
            Mygeocodequery1.QueryAsync();
        }
コード例 #50
0
ファイル: MainPage.xaml.cs プロジェクト: pjmatuck/QualDDD
 private void GetCoordinates()
 {
     try
     {
         geoQuery = new GeocodeQuery();
         geoQuery.SearchTerm = location;
         geoQuery.GeoCoordinate = new GeoCoordinate();
         geoQuery.QueryCompleted += geoQuery_QueryCompleted;
         geoQuery.QueryAsync();
     }
     catch (UnauthorizedAccessException)
     {
         throw;
     }
     catch (Exception)
     {
         // Something else happened while acquiring the location.
         throw;
     }
 }
コード例 #51
0
ファイル: MainPage.xaml.cs プロジェクト: bendata61/anyplace
        private void GetNavigationRoute(GeoCoordinate location)
        {
            // clear route details
            if (Mymap.Layers.Contains(routedetails_layer))
                Mymap.Layers.Remove(routedetails_layer);

            // clear directions
            if (GetRoute.Count != 0)
            {
                GetRoute.Clear();
                if (_myMapRoute != null)
                    Mymap.RemoveRoute(_myMapRoute);
            }

            GeoCoordinate g = new GeoCoordinate();
            if (_externalSource)
                g = _externalCoordinates;
            else
            {
                g = new GeoCoordinate(_myLatitude, _myLongitude);
            }
            // set phone current location
            GetRoute.Add(g);
            _mygeocodequery = new GeocodeQuery
            {
                SearchTerm = location.ToString(),
                GeoCoordinate = g
            };
            _mygeocodequery.QueryCompleted += Mygeocodequery_QueryCompleted;
            _mygeocodequery.QueryAsync();
        }
コード例 #52
0
        private void getDestination()
        {
            Mygeocodequery = new GeocodeQuery();
            //Mygeocodequery.SearchTerm = DestinationTextBox.Text;
            Mygeocodequery.SearchTerm = XAMLAutoCompleteBox.Text;
            Mygeocodequery.GeoCoordinate = MyCoordinates[0];

            Mygeocodequery.QueryCompleted += Mygeocodequery_QueryCompleted;
            Mygeocodequery.QueryAsync();
        }