private void GetLocationAndShow(MapProvider mapProvider) { List <LocationCoordinate> locationCoordinates = new List <LocationCoordinate>(); DataGridView dataGridView = dataGridViewMap; foreach (DataGridViewCell dataGridViewCell in dataGridView.SelectedCells) { if (LocationCoordinate.TryParse(DataGridViewHandler.GetCellValueNullOrStringTrim(dataGridView, dataGridViewCell.ColumnIndex, dataGridViewCell.RowIndex), out LocationCoordinate locationCoordinate)) { if (!locationCoordinates.Contains(locationCoordinate)) { locationCoordinates.Add(locationCoordinate); } } } ShowMediaOnMap.UpdatedBroswerMap(browser, locationCoordinates, GetZoomLevel(), mapProvider); }
public static void GetUserInputChanges(DataGridView dataGridView, ref Metadata metadata, FileEntryAttribute fileEntryAttribute, int columnIndex = -1) { if (fileEntryAttribute == null && columnIndex == -1) { //DEBUG return; } if (columnIndex == -1) { columnIndex = DataGridViewHandler.GetColumnIndexUserInput(dataGridView, fileEntryAttribute); } if (columnIndex == -1) { return; //Column has not yet become aggregated or has already been removed } if (!DataGridViewHandler.IsColumnPopulated(dataGridView, columnIndex)) { return; } LocationCoordinate.TryParse(DataGridViewHandler.GetCellValueNullOrStringTrim(dataGridView, columnIndex, headerMedia, tagMediaCoordinates), out LocationCoordinate locationCoordinate); metadata.LocationCoordinate = locationCoordinate; metadata.LocationName = (string)DataGridViewHandler.GetCellValue(dataGridView, columnIndex, headerMedia, tagLocationName); if (metadata.LocationName != null) { metadata.LocationName = metadata.LocationName.Trim(); } if (string.IsNullOrWhiteSpace(metadata.LocationName)) { metadata.LocationName = null; } metadata.LocationCity = (string)DataGridViewHandler.GetCellValue(dataGridView, columnIndex, headerMedia, tagCity); if (metadata.LocationCity != null) { metadata.LocationCity = metadata.LocationCity.Trim(); } if (string.IsNullOrWhiteSpace(metadata.LocationCity)) { metadata.LocationCity = null; } metadata.LocationState = (string)DataGridViewHandler.GetCellValue(dataGridView, columnIndex, headerMedia, tagProvince); if (metadata.LocationState != null) { metadata.LocationState = metadata.LocationState.Trim(); } if (string.IsNullOrWhiteSpace(metadata.LocationState)) { metadata.LocationState = null; } metadata.LocationCountry = (string)DataGridViewHandler.GetCellValue(dataGridView, columnIndex, headerMedia, tagCountry); if (metadata.LocationCountry != null) { metadata.LocationCountry = metadata.LocationCountry.Trim(); } if (string.IsNullOrWhiteSpace(metadata.LocationCountry)) { metadata.LocationCountry = null; } }