/// <summary> /// 打开指定路径的匹配结果表 /// </summary> /// <returns>返回的表内容</returns> public static ITable OpenRelateTable(out string path) { IGxDialog dlg = new GxDialog(); IGxObjectFilter pGxFilter = new GxFilterTablesClass(); dlg.ObjectFilter = pGxFilter; dlg.Title = "添加关系表"; dlg.ButtonCaption = "添加"; dlg.AllowMultiSelect = false; IEnumGxObject pEnumGxObject; dlg.DoModalOpen(0, out pEnumGxObject); if (pEnumGxObject != null) { pEnumGxObject.Reset(); IGxObject gxObj; while ((gxObj = pEnumGxObject.Next()) != null) { if (gxObj is IGxDataset) { IGxDataset gxDataset = gxObj as IGxDataset; IDataset pDataset = gxDataset.Dataset; if (pDataset.Type == esriDatasetType.esriDTTable) { ITable pTable = pDataset as ITable; if (pTable.FindField("源OID") != -1 && pTable.FindField("待更新OID") != -1 && pTable.FindField("变化标记") != -1) { path = gxObj.FullName; return(pTable); } else { MessageBox.Show("您打开的表格式不正确,请打开匹配关系表!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } } } path = string.Empty; return(null); }
private string BuscarTablaReclasificacion(string TipoTabla) { IGxDialog pGxDialog = new GxDialogClass(); IGxObjectFilter filter = new GxFilterTablesClass(); pGxDialog.Title = "Buscar Tabla " + TipoTabla; pGxDialog.ObjectFilter = filter; IEnumGxObject pEnumObj; if (pGxDialog.DoModalOpen(0, out pEnumObj)) { return(pEnumObj.Next().FullName); } else { return(""); } }
/// <summary> /// Opens a dialog so the user can select a table containing transformation information /// from a previous time. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void transformButton_Click(object sender, EventArgs e) { try { IGxObjectFilter tableFilter = new GxFilterTablesClass(); IGxDialog dlg = new GxDialogClass(); IGxObjectFilterCollection filters = (IGxObjectFilterCollection)dlg; filters.AddFilter(tableFilter, true); dlg.Title = "Select the table containing previous transform information"; dlg.ButtonCaption = "Select"; IEnumGxObject objects = null; if (dlg.DoModalOpen(0, out objects)) { IGxObject obj = objects.Next(); _transformTableName = obj.InternalObjectName; transformTextBox.Text = obj.Name; EnableSave(); } } catch (Exception ex) { ShowError(ex.Message); } }