Пример #1
0
 protected override void OnClick()
 {
     if (MapView.Active?.Map == null)
     {
         MessageBox.Show("There is no active map");
         return;
     }
     try
     {
         //The browse filter is used in an OpenItemDialog.
         BrowseProjectFilter bf = new BrowseProjectFilter
         {
             //Name the filter
             Name = "SQL Express Connection File"
         };
         //Display the filter in an Open Item dialog
         OpenItemDialog aNewFilter = new OpenItemDialog
         {
             Title           = "Open SQL Express Feature classes",
             InitialLocation = @"C:\Data\PluginData",
             MultiSelect     = false,
             BrowseFilter    = bf
         };
         bool?ok = aNewFilter.ShowDialog();
         if (!(ok.HasValue && ok.Value))
         {
             return;
         }
         _ = AddToCurrentMap.AddProDataSubItemsAsync(aNewFilter.Items.OfType <ProDataSubItem>(), MapView.Active.Map);
     }
     catch (Exception ex)
     {
         MessageBox.Show($@"Exception: {ex.ToString()}");
     }
 }
        void IMappableItem.OnAddToMap(Map map)
        {
            System.Diagnostics.Debug.WriteLine("OnAddToMap");
            IList <ProDataSubItem> lst = new List <ProDataSubItem>();

            lst.Add(this);
            _ = AddToCurrentMap.AddProDataSubItemsAsync(lst, map);
        }
        string[] IMappableItemEx.OnAddToMapEx(Map map, ILayerContainerEdit groupLayer, int index)
        {
            System.Diagnostics.Debug.WriteLine("OnAddToMap");
            IList <ProDataSubItem> lst = new List <ProDataSubItem>();

            lst.Add(this);
            _ = AddToCurrentMap.AddProDataSubItemsAsync(lst, map);
            return(new string[] { this.ComboPath });
        }