Esempio n. 1
0
        protected override void OnClick()
        {
            if (!_initialized)
            {
                _initialized = true;
                ForTheUcModule.SubscribeToEvent(evt => {
                    MessageBox.Show(evt.Tag, "Event Received");
                });
            }
            string time = DateTime.Now.ToString("G");

            CustomEventChanged.Publish(string.Format("From {0} : {1}",
                                                     this.GetType().ToString(), time));
        }
Esempio n. 2
0
        private async void Button_Click(object sender, RoutedEventArgs e)
        {
            // get the current module to access helper method
            ForTheUcModule module = ForTheUcModule.Current;

            // remove any existing graphics
            MapView mapView = ForTheUcModule.ActiveMapView;

            GeocodeUtils.RemoveFromMapOverlay(mapView);

            try
            {
                // initiate the search
                CandidateResponse results = GeocodeUtils.SearchFor(this.SearchText.Text, 1);
                if (results.OrderedResults.Count > 0)
                {
                    // add a point graphic overlay
                    GeocodeUtils.UpdateMapOverlay(results.OrderedResults[0].ToPointN(), mapView);
                    // zoom to the location
                    await GeocodeUtils.ZoomToLocation(results.OrderedResults[0].Extent);

                    // add the search results to the dialog window
                    this.LastSearch.Text = string.Format("Last Match: {0}", results.OrderedResults[0].CandidateDetails);
                }
                else
                {
                    ArcGIS.Desktop.Internal.Framework.DialogManager.ShowMessageBox(
                        string.Format("No results returned for {0}", this.SearchText.Text), "GeocodeExample");
                }
            }
            catch (Exception ex)
            {
                string errorName = "Search Error";
                System.Diagnostics.Trace.WriteLine(string.Format("{0}: {1}", errorName, ex.ToString()));
                ArcGIS.Desktop.Internal.Framework.DialogManager.ShowMessageBox(errorName, this.SearchText.Text);
            }
        }
 protected override void OnClick()
 {
     ForTheUcModule.ToggleState(MyStateID);
 }