private void mnuSourceD_Click(object sender, EventArgs e)
{
int FCount;
DirectoryInfo[] instDirs;
IWorkspaceFactory theWSFact;
IWorkspace theWS;
IFeatureWorkspace theFWS;
IFeatureClass theFClass;
// get the directory that is to be scanned for Shapefiles or Geodatabases
DialogResult theAns;
FolderBrowserDialog DirBrowserDlg = new FolderBrowserDialog();
DirBrowserDlg.RootFolder = Environment.SpecialFolder.MyComputer;
DirBrowserDlg.Description = "Select the Parent Folder containing Geospatial Items.";
theAns = DirBrowserDlg.ShowDialog();
if (theAns == DialogResult.OK)
{
DirectoryInfo iDir = new DirectoryInfo(DirBrowserDlg.SelectedPath);
try
{
instDirs = iDir.GetDirectories();
foreach (DirectoryInfo theDir in instDirs)
{
}
foreach (FileInfo theFile in iDir.GetFiles("*.mdb"))
{
theWSFact = new AccessWorkspaceFactoryClass();
theWS = theWSFact.OpenFromFile(theFile.FullName, 0);
String[] theSrcNames = GeoDbProcs.GetFeatureClassNames(srcWrkSpc);
foreach (String theSrcName in theSrcNames)
{
theFWS = (IFeatureWorkspace)theWS;
theFClass = theFWS.OpenFeatureClass(theSrcName);
lbSource.Items.Add(new FeatureData(theSrcName, theFClass));
Application.DoEvents();
}
CheckforGeoSpatialData(iDir.FullName, "ShapeFile", lbSource);
}
}
catch (Exception ex) { }
}
}