Beispiel #1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            this.Text                    = "Store Finder";
            gMap.MapProvider             = GMap.NET.MapProviders.GoogleMapProvider.Instance;
            GMap.NET.GMaps.Instance.Mode = GMap.NET.AccessMode.ServerOnly;
            var geocoder = new Geocoder.GeocodeService();
            var location = geocoder.GeocodeLocation("Palo Alto, CA");

            centerMap(location);
            markerOverlay = new GMap.NET.WindowsForms.GMapOverlay(gMap, "markers");
            gMap.Overlays.Add(markerOverlay);
        }
Beispiel #2
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            string address = "";

            if (txtStreetAddress.Text != "" && txtCity.Text != "" && txtState.Text != "")
            {
                address = txtStreetAddress.Text + "," + txtCity.Text + "," + txtState.Text;
            }
            else if (txtCity.Text != "" && txtState.Text != "")
            {
                address = txtCity.Text + "," + txtState.Text;
            }
            else if (txtZip.Text != "")
            {
                address = txtZip.Text;
            }

            if (address == "")
            {
                MessageBox.Show("Enter a valid address, city, or zip code");
            }
            else
            {
                var geocoder = new Geocoder.GeocodeService();
                var location = geocoder.GeocodeLocation(address);
                storeList.Items.Clear();
                txtStoreDetails.Text = "";
                markerOverlay.Markers.Clear();
                centerMap(location);
                markCurrentLocation(location);
                stores = findStores();
                for (int i = 0; i < stores.Count; i++)
                {
                    markStoreLocation(stores[i]);
                }
                addStoresToList();
            }
        }
Beispiel #3
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {

            string address = "";
            if (txtStreetAddress.Text != "" && txtCity.Text != "" && txtState.Text != "") { address = txtStreetAddress.Text + "," + txtCity.Text + "," + txtState.Text; }
            else if (txtCity.Text != "" && txtState.Text != ""){ address = txtCity.Text + "," + txtState.Text;}
            else if (txtZip.Text != "") { address = txtZip.Text; }

            if (address == "") { MessageBox.Show("Enter a valid address, city, or zip code");}
            else {
                var geocoder = new Geocoder.GeocodeService();
                var location = geocoder.GeocodeLocation(address);
                storeList.Items.Clear();
                txtStoreDetails.Text = "";
                markerOverlay.Markers.Clear(); 
                centerMap(location); 
                markCurrentLocation(location);
                stores = findStores();
                for (int i = 0; i < stores.Count; i++) { markStoreLocation(stores[i]); }
                addStoresToList();

            }
            
        }
Beispiel #4
0
 private void Form1_Load(object sender, EventArgs e)
 {
     this.Text = "Store Finder";
     gMap.MapProvider = GMap.NET.MapProviders.GoogleMapProvider.Instance;
     GMap.NET.GMaps.Instance.Mode = GMap.NET.AccessMode.ServerOnly;
     var geocoder = new Geocoder.GeocodeService();
     var location = geocoder.GeocodeLocation("Palo Alto, CA");
     centerMap(location);
     markerOverlay = new GMap.NET.WindowsForms.GMapOverlay(gMap, "markers");
     gMap.Overlays.Add(markerOverlay);
 }