/// <summary> /// Occurs when this command is clicked /// </summary> public override void OnClick() { ILayer lyr = (m_globeHookHelper.Globe as IMap).get_Layer(0); if (lyr is IFeatureLayer) { UI.FrmClassFields frmAddFields = new UI.FrmClassFields(); frmAddFields.TargetClass = (lyr as IFeatureLayer).FeatureClass as IClass; frmAddFields.ShowDialog(); } }
public override void OnClick() { UI.FrmClassFields frmAddFields = new UI.FrmClassFields(); frmAddFields.TargetClass = this.m_HookHelper.CurrentCatalogItem.Dataset as IClass; if (frmAddFields.ShowDialog() == DialogResult.OK) { try { List<IField> newFields = frmAddFields.NewFieldList; if (Utility.GpTool.AddFields(this.m_HookHelper.CurrentCatalogItem.Dataset as ITable, newFields)) { XtraMessageBox.Show("添加字段成功"); } else { XtraMessageBox.Show(string.Format("抱歉,添加操作失败了!\n信息:{0}", Utility.GpTool.ErrorMessage)); } } catch (Exception exp) { XtraMessageBox.Show(string.Format("抱歉,添加操作发生了错误!\n信息:{0}", exp.Message)); } } }
public override void OnClick() { UI.FrmClassFields frmAddFields = new UI.FrmClassFields(); frmAddFields.TargetClass = this.m_HookHelper.CurrentCatalogItem.Dataset as IClass; if (frmAddFields.ShowDialog() == DialogResult.OK) { try { List <IField> newFields = frmAddFields.NewFieldList; if (Utility.GpTool.AddFields(this.m_HookHelper.CurrentCatalogItem.Dataset as ITable, newFields)) { XtraMessageBox.Show("添加字段成功"); } else { XtraMessageBox.Show(string.Format("抱歉,添加操作失败了!\n信息:{0}", Utility.GpTool.ErrorMessage)); } } catch (Exception exp) { XtraMessageBox.Show(string.Format("抱歉,添加操作发生了错误!\n信息:{0}", exp.Message)); } } }