public void AddServices() { using (var form = new AddServicesForm()) { var dialogResult = form.ShowDialog(); if (dialogResult == DialogResult.OK) { DownloadMetadata(); } } }
void mnuAddServices_Click(object sender, EventArgs e) { if (_addServicesForm == null) { _addServicesForm = new AddServicesForm(); } DialogResult result = _addServicesForm.ShowDialog(); if (_mainForm != null) { _mainForm.SelectNewServices(); } }
public override void OnClick() { try { var mxdoc = (IMxDocument)_application.Document; var map = mxdoc.FocusMap; var addServicesForm = new AddServicesForm(); var result = addServicesForm.ShowDialog(new ArcMapWindow(_application)); if (result == DialogResult.OK) { var selectedService = addServicesForm.SelectedService; // Fix the service labs.metacarta.com bug: it doubles the version :-( selectedService.Href = selectedService.Href.Replace(@"1.0.0/1.0.0", @"1.0.0").Trim(); var layerType = EnumBruTileLayer.TMS; // If the type is inverted TMS we have to do something special if (selectedService.Type != null) { if (selectedService.Type == "InvertedTMS") { layerType = EnumBruTileLayer.InvertedTMS; } } var brutileLayer = new BruTileLayer(_application, layerType, selectedService.Href, selectedService.OverwriteUrls) { Name = selectedService.Title, Visible = true }; map.AddLayer(brutileLayer); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }