private void UpdateSourceFields() { cbXCoordField.Items.Clear(); cbYCoordField.Items.Clear(); if (!System.IO.File.Exists(SourceDataFile)) { return; } string[] fieldNames = CsvUtil.ReadFieldHeaders(SourceDataFile); if (fieldNames == null || fieldNames.Length == 0) { return; } CsvUtil.TrimValues(fieldNames, new char[] { '"', '\'' }); cbXCoordField.Items.AddRange(fieldNames); cbYCoordField.Items.AddRange(fieldNames); CsvUtil.TrimValues(fieldNames); int xIndex = -1, yIndex = -1; xIndex = Array.FindIndex <string>(fieldNames, s => s.IndexOf("Longitude", StringComparison.OrdinalIgnoreCase) >= 0); if (xIndex < 0) { xIndex = Array.FindIndex <string>(fieldNames, s => s.IndexOf("Easting", StringComparison.OrdinalIgnoreCase) >= 0); } if (xIndex < 0) { xIndex = Array.FindIndex <string>(fieldNames, s => s.IndexOf("Lon", StringComparison.OrdinalIgnoreCase) >= 0); } if (xIndex < 0) { xIndex = Array.FindIndex <string>(fieldNames, s => s.IndexOf("East", StringComparison.OrdinalIgnoreCase) >= 0); } yIndex = Array.FindIndex <string>(fieldNames, s => s.IndexOf("Latitude", StringComparison.OrdinalIgnoreCase) >= 0); if (yIndex < 0) { yIndex = Array.FindIndex <string>(fieldNames, s => s.IndexOf("Northing", StringComparison.OrdinalIgnoreCase) >= 0); } if (yIndex < 0) { yIndex = Array.FindIndex <string>(fieldNames, s => s.IndexOf("Lat", StringComparison.OrdinalIgnoreCase) >= 0); } if (yIndex < 0) { yIndex = Array.FindIndex <string>(fieldNames, s => s.IndexOf("North", StringComparison.OrdinalIgnoreCase) >= 0); } if (xIndex >= 0) { cbXCoordField.SelectedIndex = xIndex; } if (yIndex >= 0) { cbYCoordField.SelectedIndex = yIndex; } }