I have a process where users can migrate a database from the ArcMap version of our tool to the Pro version. Users select their existing GDB using the OpenItemDialog, but if they've already added it to the project and select it from the Project section (highlighted), the Items collection is empty. Is there a way to access the selected Project Item? I'm using SDK 2.9.2.
Selection code:
var picker = new ArcGIS.Desktop.Catalog.OpenItemDialog
{
AlwaysUseInitialLocation = true,
InitialLocation = Environment.GetFolderPath(Environment.SpecialFolder.Desktop),
BrowseFilter = new ArcGIS.Desktop.Core.BrowseProjectFilter(DAML.Component.esri_browseDialogFilters_geodatabases_file),
MultiSelect = false,
Title = "Legacy File Geodatabase"
};
picker.ShowDialog();
var selection = picker.Items.FirstOrDefault();
if (selection == null)
{
// *** Selecting an existing Project Item goes here.
MessageBox.Show("No item selected");
}
else
{
// Run migration
}