/// <summary> /// Occurs when this command is clicked /// </summary> public override void OnClick() { IMapControl4 mapControl = null; AttributeEventArgs evt = new AttributeEventArgs(); try { if (m_hookHelper.Hook is IMapControl4) mapControl = (IMapControl4)m_hookHelper.Hook; else if (m_hookHelper.Hook is IToolbarControl2) { IToolbarControl2 toolbarControl = (IToolbarControl2)m_hookHelper.Hook; mapControl = (IMapControl4)toolbarControl.Buddy; } } catch (Exception ex) { System.Diagnostics.Trace.WriteLine(ex.Message); } if (m_hookHelper != null) { //TODO: Add Map/PageLayout related logic //MessageBox.Show(this.Name); IEnumFeature numFeature = (IEnumFeature)mapControl.ActiveView.FocusMap.FeatureSelection; IFeature feature = numFeature.Next(); //MessageBox.Show(feature.get_Value(feature.Fields.FindField(nameOfMaThua)).ToString()); //int index = feature.Fields.FindField("mathua"); //if (index == -1) //{ // index = feature.Fields.FindField("mathua_"); //} int oidIndex = feature.Fields.FindField("OBJECTID"); if (oidIndex == -1) { oidIndex=feature.Fields.FindField("FID"); } keyValue = feature.get_Value(feature.Fields.FindField(keyName)); oid = feature.get_Value(oidIndex); evt.PrimaryKey = keyValue; evt.Objectid = oid; OnChanged(evt); } else if (m_sceneHookHelper != null) { //TODO: Add Scene related logic } else if (m_globeHookHelper != null) { //TODO: Add Globe related logic } }
void _moBangThuocTinh_OpenAttributeTable(object sender, AttributeEventArgs e) { IEditTableView tableView = new BaseTableView(); //tableView.ExpectedTableName= //IAttributeView attView = new FrmAttribute(); //attView.SetParent(this); //string tableName = string.Format("{0}_{1}", DataNameTemplate.Thua, _curConfig.NamApDung); //attView.SetTitle(tableName); //attView.SetTableName(tableName); //attView.SetAliasFieldsName(_fcName.FC_THUA.ALIAS_FIELD_LIST); //attView.SetMapView(this._mapView); //attView.Show(); }
/// <summary> /// Triggers the Changed event. /// </summary> public virtual void OnChanged(AttributeEventArgs ea) { if (OpenAttributeTable != null) OpenAttributeTable(null/*this*/, ea); }