Esempio n. 1
0
 private void buttonSaveBingKey_Click(object sender, EventArgs e)
 {
     try
     {
         BingMapHelper.PutKeyString(textBingMapsKey.Text.Trim());
     }
     catch (Exception ex)
     {
         alert($"Cannot Save Key. Err={ex}");
     }
 }
Esempio n. 2
0
        private void FormGis_Load(object sender, EventArgs e)
        {
            try
            {
                textBingMapsKey.Text   = BingMapHelper.GetKeyString();
                textGoogleMapsKey.Text = GoogleMapHelper.GetKeyString(out string explanation);

                comboGisSource.Items.Clear();
                comboGisSource.Items.Add("Bing");
                comboGisSource.Items.Add("Google");

                BuildMapTransform();
            }
            catch (Exception ex)
            {
                alert($"Err={ex}");
            }
        }
Esempio n. 3
0
        private void buttonQueryBingMaps_Click(object sender, EventArgs e)
        {
            try
            {
                textBingMapsResponse.Text = "";

                if (!BingMapHelper.GetRoute(textBingMapsKey.Text, textBingMapsFrom.Text, textBingMapsTo.Text,
                                            out SimioMapRoute mapRoute,
                                            out string requestUrl, out string explanation))
                {
                    alert($"Cannot Get Route. Err={explanation}");
                    return;
                }

                MapRoute = mapRoute;
                textBingMapsRequestUrl.Text = requestUrl;
                textBingMapsResponse.Text   = explanation;
            }
            catch (Exception ex)
            {
                throw new ApplicationException($"QueryBingMaps Error={ex}");
            }
        }
Esempio n. 4
0
        public NavigateToAddress()
        {
            WaterMarkText = "Enter an Address";
            DisplayText = "Locate Address";
            Icon = new Uri("/Resources/Images/SearchIcon.png", UriKind.Relative);
            PerformAction = new RelayCommand<RoutedEventArgs>(e =>
            {
                BingMapHelper bingIt = new BingMapHelper();

                MapDetails mapDetails = null;
                Messenger.Default.Register<MapDetails>(this, NotificationTokens.SendMapDetails, d =>
                {
                    mapDetails = d;
                });
                Messenger.Default.Send<object>(null, NotificationTokens.GetMapDetails);

                if (mapDetails != null)
                {
                    // Subscript to Completed Event to get Data after Async Call.
                    bingIt.LocateAddressCompleted += new GeoCodeRequestCompletedEventHandler(bingIt_LocateAddressCompleted);
                    bingIt.LocateAddress(UserInput, mapDetails.Culture, mapDetails.Credentials);
                }
            });
        }