/// <summary> /// Occurs when this command is clicked /// </summary> public override void OnClick() { try { IGxDialog gxDialog = new GxDialogClass(); IGxObjectFilter mdbFilter = new GxFilterPGDBFeatureClasses(); gxDialog.ObjectFilter = mdbFilter; object temp = "C:\\"; gxDialog.set_StartingLocation(ref temp); gxDialog.Title = "Pick the feature class you want to add the ext clsid to"; gxDialog.RememberLocation = true; IEnumGxObject pEnumGx; if (!gxDialog.DoModalOpen(0, out pEnumGx)) { return; } IGxObject gdbObj = pEnumGx.Next(); //Make sure there was only one GxObject in the enum. if (pEnumGx.Next() != null) { return; } //Get the Name for the internal object that this GxObject represents. IName fcName = gdbObj.InternalObjectName; //Opens the object referred to by this name IFeatureClass featClass = (IFeatureClass)fcName.Open(); //Procedure to add the class id to the feature class internally. IClassSchemaEdit_Example(featClass); } catch (Exception ex) { MessageBox.Show("Error: Could open the feature class. Original error: " + ex.Message); } }
/// <summary> /// Occurs when this command is clicked /// </summary> public override void OnClick() { try { IGxDialog gxDialog = new GxDialogClass(); IGxObjectFilter mdbFilter = new GxFilterPGDBFeatureClasses(); gxDialog.ObjectFilter = mdbFilter; object temp = "C:\\"; gxDialog.set_StartingLocation(ref temp); gxDialog.Title = "Pick the feature class you want to add the ext clsid to"; gxDialog.RememberLocation = true; IEnumGxObject pEnumGx; if (!gxDialog.DoModalOpen(0, out pEnumGx)) return; IGxObject gdbObj = pEnumGx.Next(); //Make sure there was only one GxObject in the enum. if (pEnumGx.Next() != null) return; //Get the Name for the internal object that this GxObject represents. IName fcName = gdbObj.InternalObjectName; //Opens the object referred to by this name IFeatureClass featClass = (IFeatureClass)fcName.Open(); //Procedure to add the class id to the feature class internally. IClassSchemaEdit_Example(featClass); } catch (Exception ex) { MessageBox.Show("Error: Could open the feature class. Original error: " + ex.Message); } }