Exemple #1
0
        private SearchLocationsResponse GetFedExLocations(string zipCode)
        {
            zipCode = zipCode == "" ? "91748" : zipCode;                         // For test
            Address address = new Address();

            address.PostalCode  = zipCode;
            address.CountryCode = "US"; // CountryCode is required
            SearchLocationsResponse repsonse = LocatorBiz.Locate(address);

            return(repsonse);
        }
Exemple #2
0
        private void AddPushpins(SearchLocationsResponse locsResp)
        {
            MapLayer layerPin = new MapLayer();
            int      idx      = 0;

            foreach (GeoMapLocation loc in locsResp.GeoMapLocations)
            {
                idx += 1;
                Pushpin pin = new Pushpin();
                pin.Location = new Location(loc.Latitude, loc.Longitude);
                pin.Content  = idx;
                string addressStr = ComposeAddress(loc);
                pin.ToolTip    = addressStr;
                pin.MouseDown += new MouseButtonEventHandler(PushpinClicked);
                MapLayer.SetPosition(pin, pin.Location);
                fedExLocatorMap.Children.Add(pin);
            }
        }
Exemple #3
0
        public FedExLocator(string zipCode)
        {
            InitializeComponent();
            SearchLocationsResponse locsResp = GetFedExLocations(zipCode);

            if (locsResp.GeoMapLocations.Count > 0)
            {
                fedExLocatorMap.Focus();
                AddPushpins(locsResp);
                GeoMapLocation firstLoc = locsResp.GeoMapLocations.First();
                Location       center   = new Location(firstLoc.Latitude, firstLoc.Longitude);
                fedExLocatorMap.SetView(center, 12); // zoom in to first location
            }
            else
            {
                MessageBox.Show("Unable to find any FedEx location. \nPlease try another ZIP code.");
            }
        }