public static void NewFilterPolygonFileGDB() { //Create and use a new filter to view Polygon feature classes in a file GDB. //The browse filter is used in an OpenItemDialog. BrowseProjectFilter bf = new BrowseProjectFilter { //Name the filter Name = "Polygon feature class in FGDB" }; //Add typeID for Polygon feature class bf.AddCanBeTypeId("fgdb_fc_polygon"); //Allow only File GDBs bf.AddDontBrowseIntoFlag(BrowseProjectFilter.FilterFlag.DontBrowseFiles); bf.AddDoBrowseIntoTypeId("database_fgdb"); //Display only folders and GDB in the browse dialog bf.Includes.Add("FolderConnection"); bf.Includes.Add("GDB"); //Does not display Online places in the browse dialog bf.Excludes.Add("esri_browsePlaces_Online"); //Display the filter in an Open Item dialog OpenItemDialog aNewFilter = new OpenItemDialog { Title = "Open Polygon Feature classes", InitialLocation = @"C:\Data", MultiSelect = false, BrowseFilter = bf }; bool?ok = aNewFilter.ShowDialog(); }
protected override async void OnClick() { //Create and use a new filter to view Polygon feature classes in a file GDB. //The browse filter is used in an OpenItemDialog. BrowseProjectFilter bf = new BrowseProjectFilter { //Name the filter Name = "Polygon feature class in FGDB" }; //Add typeID for Polygon feature class bf.AddCanBeTypeId("fgdb_fc_polygon"); //Allow only File GDBs bf.AddDontBrowseIntoFlag(BrowseProjectFilter.FilterFlag.DontBrowseFiles); bf.AddDoBrowseIntoTypeId("database_fgdb"); //Display only folders and GDB in the browse dialog bf.Includes.Add("FolderConnection"); bf.Includes.Add("GDB"); //Does not display Online places in the browse dialog bf.Excludes.Add("esri_browsePlaces_Online"); //Display the filter in an Open Item dialog OpenItemDialog dlg = new OpenItemDialog { Title = "Open Polygon Feature classes", //InitialLocation = Path.GetDirectoryName(Project.Current.URI), AlwaysUseInitialLocation = false, MultiSelect = true, BrowseFilter = bf }; bool?ok = dlg.ShowDialog(); if (ok == true) { var items = dlg.Items; if (MapView.Active != null) { var _map = MapView.Active.Map; await QueuedTask.Run(() => { foreach (Item item in items) { LayerFactory.Instance.CreateLayer(item, _map); } }); } } }
protected override void OnClick() { var bf = new BrowseProjectFilter(); //This allows us to view the .quake custom item (the "container") bf.AddCanBeTypeId("acme_quake_handler"); //TypeID for the ".quake" custom project item //This allows the .quake item to be browsable to access the events inside bf.AddDoBrowseIntoTypeId("acme_quake_handler"); //This allows us to view the quake events contained in the .quake item bf.AddCanBeTypeId("acme_quake_event"); //TypeID for the quake events contained in the .quake item bf.Name = "Quake Item"; var openItemDialog = new OpenItemDialog { Title = "Open Quake Item", InitialLocation = @"E:\Data\CustomItem\QuakeCustomItem", BrowseFilter = bf }; bool?ok = openItemDialog.ShowDialog(); }