public string createNewLayerName() { //Construct layer name ConstructLayerName newLayer = new ConstructLayerName(); string newLayerName = newLayer.LoopThroughNameElements(GetFormElementValues()); return(newLayerName); }
public static Boolean checkPathToLookupCSV() { string _path = ConstructLayerName.pathToLookupCSV() + @"\geoextent.csv"; // Checks to see if the 'geoextent.csv' file exist in the config tool directory if (File.Exists(_path)) { return(true); } else { return(false); } }
protected override void OnClick() { try { IGxApplication pApp = ArcMap.Application as IGxApplication; string pathFileName = pApp.SelectedObject.FullName; string root = System.IO.Path.GetDirectoryName(pathFileName); string filename = System.IO.Path.GetFileNameWithoutExtension(pathFileName); IFeatureClass fc = GetFeatureClassFromShapefileOnDisk(root, filename); IDataset ds = fc as IDataset; if (fc == null) { MessageBox.Show("This tool works on the context menu of a shapefile in ArcCatalog. Please check your installation.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } else { //Check to see the csv files exist (Check is only for extent.csv) if (ConstructLayerName.checkPathToLookupCSV()) { frmMain dlg = new frmMain(); dlg.ShowDialog(); } else { MessageBox.Show("The path to the CSV files is incorrect. Please set the correct path in the config tool.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } } catch (Exception e) { Debug.WriteLine(e.Message); return; } }