private void mapCtl_Station_DoubleClick(object sender, EventArgs e) { var selections = mapCtl_Station.Map.FindSelection(true); if(selections.Count()>0) { var rs = selections[0].ToRecordset(); if(rs.RecordCount>0) { rs.MoveFirst(); var smId = rs.GetID(); var layerName = rs.Dataset.Name; var layerInfo = LayerService.INSTANCE.GetStationLayerInfos().First(l => l.LayerName == layerName); var dt = GISUtility.RecordsetToDataTable(rs, layerInfo); if (!rs.IsClosed) { rs.Close(); rs.Dispose(); } var selectedRow = dt.Select(string.Format("SMID = '{0}'", smId))[0]; var eqptInfo = new DlgEqptInfo(smId, layerInfo, ref selectedRow); eqptInfo.ShowDialog(); } } }
void gv_DoubleClick(object sender, EventArgs e) { var gv = sender as GridView; if(gv.FocusedRowHandle<0) return; var smId = Convert.ToInt32(gv.GetFocusedRowCellValue("SMID")); var selectedRow = (gv.GridControl.DataSource as DataTable).Select(string.Format("SMID = '{0}'", smId))[0]; var eqptInfo = new DlgEqptInfo(smId, (LayerInfo) gv.Tag, ref selectedRow); eqptInfo.ShowDialog(); gv.GridControl.RefreshDataSource(); }