예제 #1
0
        public static void NewFilterForCustomItem()
        {
            //Create and use a dialog filter to view a Custom item
            //The browse filter is used in an OpenItemDialog.

            BrowseProjectFilter bf = new BrowseProjectFilter();

            //Name the filter
            bf.Name = "\"customItem\" files";
            //Add typeID for Filters_ProGPXItem custom item
            bf.AddCanBeTypeId("Filters_ProGPXItem");
            //Does not allow browsing into files
            bf.AddDontBrowseIntoFlag(BrowseProjectFilter.FilterFlag.DontBrowseFiles);
            //Display only folders and GDB in the browse dialog
            bf.Includes.Add("FolderConnection");
            //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 \"customItem\"",
                InitialLocation = @"C:\Data",
                MultiSelect     = false,
                BrowseFilter    = bf
            };
            bool?ok = aNewFilter.ShowDialog();
        }
예제 #2
0
        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 void OnClick()
        {
            var bf = new BrowseProjectFilter();

            //This allows us to view the .quake custom item (the "container")
            //This allows the .quake item to be browsable to access the events inside
            bf.AddCanBeTypeId("acme_quake_event");

            bf.Name = "Quake Event Item";

            var openItemDialog = new OpenItemDialog
            {
                Title           = "Add Quake Event to Map",
                InitialLocation = @"E:\Data\CustomItem\QuakeCustomItem",
                BrowseFilter    = bf,
                MultiSelect     = false
            };
            bool?ok = openItemDialog.ShowDialog();

            if (ok != null)
            {
                if (ok.Value)
                {
                    var quake_event = openItemDialog.Items.First() as QuakeEventCustomItem;
                    QueuedTask.Run(() =>
                    {
                        Module1.AddToGraphicsLayer(quake_event);
                    });
                }
            }
        }
예제 #4
0
        // TODO algr: temporary tests
        protected override void OnClick()
        {
            var bf = new BrowseProjectFilter();

            bf.AddCanBeTypeId("ProSuiteItem_ProjectItem");             //TypeID for the ".wlist" custom project item

            // for subitem allow to browse inside and add as type
            //bf.AddDoBrowseIntoTypeId("ProSuiteItem_ProjectItemWorkListFile");
            //bf.AddCanBeTypeId("ProSuiteItem_WorkListItem"); //subitem
            bf.Name = "Work List";

            var openItemDialog = new OpenItemDialog
            {
                Title = "Add Work List",
                //InitialLocation = "",
                BrowseFilter = bf
            };
            bool?result = openItemDialog.ShowDialog();

            if (result != null && (result.Value == false || !openItemDialog.Items.Any()))
            {
                return;
            }

            var    item     = openItemDialog.Items.FirstOrDefault();
            string filePath = item?.Path;

            QueuedTask.Run(() =>
            {
                ProjectRepository.Current.AddProjectFileItems(ProjectItemType.WorkListDefinition, new List <string>()
                {
                    filePath
                });
            });
        }
예제 #5
0
        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();
        }
        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);
                        }
                    });
                }
            }
        }
        private void InitBrowseFilter()
        {
            // C:\Program Files\ArcGIS\Pro\Resources\SearchResources\Schema\BrowseFilters.xml
            _featureClassBrowseFilter = new BrowseProjectFilter("esri_browseDialogFilters_featureClasses_all")
            {
                Name = "Shape Files/Feature Classes/Zip Files"
            };
            _featureClassBrowseFilter.AddCanBeTypeId("file_zip");

            // use "esri_browseDialogFilters_workspaces_all" to include geodatabase locations
            _workspaceBrowseFilter = new BrowseProjectFilter("esri_browseDialogFilters_folders")
            {
                Name = "Folders/Datasets"
            };

            // use "esri_browseDialogFilters_shapefiles" for shape files only
            _outputExtentBrowseFilter = new BrowseProjectFilter("esri_browseDialogFilters_featureClasses_all")
            {
                Name = "Shape Files/Feature Classes"
            };
        }
예제 #8
0
        public static void ModifyExistingProLyrxFilter()
        {
            //Creates a new browse filter from Pro's "esri_browseDialogFilters_layers_lyrx" browse filter to display lyr files also.
            //The browse filter is used in an OpenItemDialog.
            BrowseProjectFilter lyrXLyrGeneral = new BrowseProjectFilter("esri_browseDialogFilters_layers_lyrx");

            lyrXLyrGeneral.Name = "Layer Files (LYRX) and Layer Files (LYR)";
            lyrXLyrGeneral.AddCanBeTypeId("layer_general");
            lyrXLyrGeneral.AddDontBrowseIntoFlag(BrowseProjectFilter.FilterFlag.DontBrowseFiles);
            //Display only folders and GDB in the browse dialog
            lyrXLyrGeneral.Includes.Add("FolderConnection");
            lyrXLyrGeneral.Includes.Add("GDB");
            //Does not display Online places in the browse dialog
            lyrXLyrGeneral.Excludes.Add("esri_browsePlaces_Online");
            //Display the filter in an Open Item dialog
            OpenItemDialog aNewFilter = new OpenItemDialog
            {
                Title           = "Open LyrX and Lyr General files",
                InitialLocation = @"C:\Data",
                MultiSelect     = false,
                BrowseFilter    = lyrXLyrGeneral
            };
            bool?ok = aNewFilter.ShowDialog();
        }