Is there a way of making the user select a .sde file using a IGxDialog ?
Yes,
Simply browse the file with extension .sde.
This file will be located in windows folder with the name you careate in database connection
C:\Users\"Your User"\AppData\Roaming\ESRI\Desktop10.3\ArcCatalog
Hi Nirdesh, I wish to achieve this programmtically. Like GxFilterShapefiles is used to filter Shapfiles. GxFilterPointFeatureClasses is sued for point Featureclasses and so on. Regards, Nigel
Create your own GxFilter and assign to IGxDialog.ObjectFilter.
Suggest deriving from GxFilterWorkspacesClass and just overriding CanDisplayObject method.
e.g. something like:
[ComVisible(true)] [Guid("...")] [ProgId("GxFilterSDEWorkspaces.Class")] public class GxFilterSDEWorkspacesClass : global::ESRI.ArcGIS.Catalog.GxFilterWorkspacesClass { public GxFilterSDEWorkspacesClass() : base() { } //--------------------------------------------------------------------- public override bool CanDisplayObject( IGxObject OBJECT ) { var d = base.CanDisplayObject(OBJECT); if( !d || !OBJECT.IsValid ) return false; if( OBJECT.Category.EqualsI("Folder") ) return true; var db = OBJECT as IGxDatabase; if( db == null ) return false; var ws = db.Workspace; if( ws == null || ws.Type != esriWorkspaceType.esriRemoteDatabaseWorkspace || !ws.PathName.EndsWithI(".sde") ) return false; return true; } //--------------------------------------------------------------------- // to avoid compile errors, must override ALL base COM methods. //--------------------------------------------------------------------- public override string Description { get { return base.Description; } } public override string Name { get { return base.Name; } } public override bool CanChooseObject( IGxObject OBJECT, ref esriDoubleClickResult RESULT ) { return base.CanChooseObject(OBJECT, ref RESULT); } public override bool CanSaveObject( IGxObject LOCATION, string NEWOBJECTNAME, ref bool OBJECTALREADYEXISTS ) { return base.CanSaveObject(LOCATION, NEWOBJECTNAME, ref OBJECTALREADYEXISTS); } }
They will still see all the normal top-level folders GxDialog has, but they will only be able to see and pick connections backed by an .sde file.