private void GeoCode(LatLongInput ctlLat, LatLongInput ctlLon, bool acceptElevation) { if (GoogleEarth.IsInstalled()) { GoogleEarth.GeoTag((lat, lon, alt) => { ctlLat.Value = lat; ctlLon.Value = lon; txtPosSource.Text = "Google Earth"; if (alt.HasValue && acceptElevation) { if (OptionalQuestions.UpdateElevationQuestion.Ask(this.FindParentWindow(), alt.Value)) { optElevElevation.IsChecked = true; txtElevUpper.Text = alt.Value + ""; txtElevUnits.Text = "m"; txtElevSource.Text = "Google Earth"; } } }, ctlLat.Value, ctlLon.Value); } }
private void UxExportToGoogleEarth_Click(object sender, RoutedEventArgs e) { GoogleEarth.printToGoogleEarth(selectedObstacle); }
public SiteDetails(User user, int siteID, bool readOnly) : base(user, "Site:" + siteID) { InitializeComponent(); this.SiteID = siteID; this.IsReadOnly = readOnly; var list = new List <Ellipsoid>(GeoUtils.ELLIPSOIDS); cmbDatum.ItemsSource = new ObservableCollection <string>(list.ConvertAll((ellipsoid) => { return(ellipsoid.Name); })); if (GoogleEarth.IsInstalled()) { coordGrid.ColumnDefinitions[7].Width = new GridLength(23); } else { coordGrid.ColumnDefinitions[7].Width = new GridLength(0); } // Radio button checked event handlers optNearestPlace.Checked += new RoutedEventHandler((s, e) => { txtLocality.IsEnabled = false; txtDirectionFrom.IsEnabled = true; txtDistanceFrom.IsEnabled = true; txtFrom.IsEnabled = true; }); optLocality.Checked += new RoutedEventHandler((s, e) => { txtLocality.IsEnabled = true; txtDirectionFrom.IsEnabled = false; txtDistanceFrom.IsEnabled = false; txtFrom.IsEnabled = false; }); var service = new MaterialService(User); var model = service.GetSite(SiteID); _viewModel = new SiteViewModel(model); this.DataContext = _viewModel; tabSite.AddTabItem("Traits", new TraitControl(User, TraitCategoryType.Site, _viewModel) { IsReadOnly = readOnly }); tabSite.AddTabItem("Notes", new NotesControl(User, TraitCategoryType.Site, _viewModel) { IsReadOnly = readOnly }); tabSite.AddTabItem("Multimedia", new MultimediaControl(User, TraitCategoryType.Site, _viewModel) { IsReadOnly = readOnly }); tabSite.AddTabItem("Ownership", new OwnershipDetails(_viewModel.Model)); txtPosSource.BindUser(User, PickListType.Phrase, "Source", TraitCategoryType.Site); txtPosWho.BindUser(User, "tblSite", "vchrPosWho"); txtPosOriginal.BindUser(User, PickListType.Phrase, "OriginalDetermination", TraitCategoryType.Site); txtElevUnits.BindUser(User, PickListType.Phrase, "Units", TraitCategoryType.Site); txtElevSource.BindUser(User, PickListType.Phrase, "Source", TraitCategoryType.Site); txtGeoEra.BindUser(User, PickListType.Phrase, "Geological Era", TraitCategoryType.Site); txtGeoPlate.BindUser(User, PickListType.Phrase, "Geological Plate", TraitCategoryType.Site); txtGeoStage.BindUser(User, PickListType.Phrase, "Geological State", TraitCategoryType.Site); txtGeoFormation.BindUser(User, PickListType.Phrase, "Geological Formation", TraitCategoryType.Site); txtGeoMember.BindUser(User, PickListType.Phrase, "Geological Member", TraitCategoryType.Site); txtGeoBed.BindUser(User, PickListType.Phrase, "Geological Bed", TraitCategoryType.Site); this.ctlX1.CoordinateValueChanged += new CoordinateValueChangedHandler((s, v) => { UpdateMiniMap(ctlY1.Value, ctlX1.Value); }); this.ctlY1.CoordinateValueChanged += new CoordinateValueChangedHandler((s, v) => { UpdateMiniMap(ctlY1.Value, ctlX1.Value); }); this.ctlX2.Visibility = System.Windows.Visibility.Hidden; this.ctlY2.Visibility = System.Windows.Visibility.Hidden; txtPoliticalRegion.BindUser(User, LookupType.Region); string llmode = Config.GetUser(User, "SiteDetails.LatLongFormat", LatLongMode.DegreesMinutesSeconds.ToString()); if (!String.IsNullOrEmpty(llmode)) { LatLongMode mode = (LatLongMode)Enum.Parse(typeof(LatLongMode), llmode); SwitchLatLongFormat(mode); } optPoint.Checked += new RoutedEventHandler((s, e) => { UpdateGeomType(); }); optLine.Checked += new RoutedEventHandler((s, e) => { UpdateGeomType(); }); optBoundingBox.Checked += new RoutedEventHandler((s, e) => { UpdateGeomType(); }); optCoordsNotSpecified.Checked += new RoutedEventHandler((s, e) => { UpdateGeomType(); }); optEastingsNorthings.Checked += new RoutedEventHandler((s, e) => { UpdateGeomType(); }); optLatLong.Checked += new RoutedEventHandler((s, e) => { UpdateGeomType(); }); optElevDepth.Checked += new RoutedEventHandler(UpdateElevation); optElevElevation.Checked += new RoutedEventHandler(UpdateElevation); optElevNotSpecified.Checked += new RoutedEventHandler(UpdateElevation); if (model.PosY1.HasValue && model.PosX1.HasValue) { UpdateMiniMap(model.PosY1.Value, model.PosX1.Value); } this.PreviewDragOver += new DragEventHandler(site_PreviewDragEnter); this.PreviewDragEnter += new DragEventHandler(site_PreviewDragEnter); //this.Drop += new DragEventHandler(site_Drop); HookLatLongControl(ctlX1); HookLatLongControl(ctlY1); HookLatLongControl(ctlX2); HookLatLongControl(ctlY2); this.Loaded += new RoutedEventHandler(SiteDetails_Loaded); }