private void subclassCombo_CurrentChanged(object sender, RibbonPropertyChangedEventArgs e)
 {
     try
     {
         RibbonCombo ribbonCombo = sender as RibbonCombo;
         RibbonLabel ribbonLabel = ribbonCombo.Current as RibbonLabel;
         if (ribbonLabel != null)
         {
             FCTag fCTag = (FCTag)ribbonLabel.Tag;
             if (fCTag != null)
             {
                 AfaDocData.ActiveDocData.SetActiveFeatureClass(fCTag.GetFeatureClass(AfaDocData.ActiveDocData.DocDataset));
             }
             else
             {
                 AfaDocData.ActiveDocData.ClearActiveSubtype();
             }
         }
     }
     catch
     {
         AfaDocData.ActiveDocData.ClearActiveSubtype();
         MSCFeatureClass topActiveFeatureClass = AfaDocData.ActiveDocData.GetTopActiveFeatureClass();
         ArcGISRibbon.SetFeatureClassButtonState(topActiveFeatureClass);
     }
 }
Esempio n. 2
0
 private void fcCombo_CurrentChanged(object sender, RibbonPropertyChangedEventArgs e)
 {
     try
     {
         RibbonCombo ribbonCombo = sender as RibbonCombo;
         RibbonLabel ribbonLabel = ribbonCombo.Current as RibbonLabel;
         if (ribbonLabel != null)
         {
             FCTag           fCTag                 = (FCTag)ribbonLabel.Tag;
             MSCFeatureClass featureClass          = fCTag.GetFeatureClass(AfaDocData.ActiveDocData.DocDataset);
             MSCFeatureClass topActiveFeatureClass = AfaDocData.ActiveDocData.GetTopActiveFeatureClass();
             if (featureClass != topActiveFeatureClass)
             {
                 AfaDocData.ActiveDocData.SetActiveFeatureClass(featureClass);
                 ArcGISRibbon.SetSubTypeComboToDefault(featureClass);
             }
             ArcGISRibbon.SetFeatureClassButtonState(AfaDocData.ActiveDocData.GetActiveFeatureClassOrSubtype());
         }
     }
     catch
     {
         AfaDocData.ActiveDocData.ClearActiveFeatureClass();
         ArcGISRibbon.ClearSubtypeCombo();
         ArcGISRibbon.SetFeatureClassButtonState(AfaDocData.ActiveDocData.GetActiveFeatureClassOrSubtype());
     }
 }
        public MSCFeatureClass GetFeatureClass(MSCDataset ds, FCTag parentTag)
        {
            MSCFeatureClass featureClass = parentTag.GetFeatureClass(ds);

            foreach (MSCFeatureClass current in featureClass.SubTypes)
            {
                if (current.Name == this.fcName)
                {
                    return(current);
                }
            }
            return(null);
        }
 private void SetActiveFeatureClass(object obj)
 {
     if (obj.GetType() == typeof(FCTag))
     {
         FCTag           fCTag        = (FCTag)obj;
         MSCFeatureClass featureClass = fCTag.GetFeatureClass(AfaDocData.ActiveDocData.DocDataset);
         AfaDocData.ActiveDocData.SetActiveFeatureClass(featureClass);
         ArcGISRibbon.SetActiveFeatureClass(AfaDocData.ActiveDocData.GetActiveFeatureClassOrSubtype());
     }
     if (obj.GetType() == typeof(FCView))
     {
         FCView          fCView        = (FCView)obj;
         MSCFeatureClass featureClass2 = fCView.FC.GetFeatureClass(AfaDocData.ActiveDocData.DocDataset);
         AfaDocData.ActiveDocData.SetActiveFeatureClass(featureClass2);
         ArcGISRibbon.SetActiveFeatureClass(AfaDocData.ActiveDocData.GetActiveFeatureClassOrSubtype());
     }
     if (obj.GetType() == typeof(KeyValuePair <string, MSCFeatureClass>))
     {
         KeyValuePair <string, MSCFeatureClass> keyValuePair = (KeyValuePair <string, MSCFeatureClass>)obj;
         AfaDocData.ActiveDocData.SetActiveFeatureClass(keyValuePair.Value);
         ArcGISRibbon.SetActiveFeatureClass(AfaDocData.ActiveDocData.GetActiveFeatureClassOrSubtype());
         return;
     }
     if (obj.GetType() == typeof(KeyValuePair <string, MSCFeatureService>))
     {
         KeyValuePair <string, MSCFeatureService> keyValuePair2 = (KeyValuePair <string, MSCFeatureService>)obj;
         AfaDocData.ActiveDocData.SetActiveFeatureClass(keyValuePair2.Value);
         ArcGISRibbon.SetActiveFeatureClass(AfaDocData.ActiveDocData.GetActiveFeatureClassOrSubtype());
         return;
     }
     if (obj is MSCFeatureClass || obj is MSCFeatureService || obj is MSCFeatureClassSubType)
     {
         AfaDocData.ActiveDocData.SetActiveFeatureClass((MSCFeatureClass)obj);
         ArcGISRibbon.SetActiveFeatureClass(AfaDocData.ActiveDocData.GetActiveFeatureClassOrSubtype());
     }
 }
        private void UpdateFromClass(Identify.IdentifyFeatureClassItem newItem)
        {
            Document document = AfaDocData.ActiveDocData.Document;

            using (document.LockDocument())
            {
                FCTag           tag = newItem.Tag;
                MSCFeatureClass activeFeatureClass = AfaDocData.ActiveDocData.SetActiveFeatureClass(tag.GetFeatureClass(AfaDocData.ActiveDocData.DocDataset));
                ArcGISRibbon.SetActiveFeatureClass(activeFeatureClass);
                ObjectId[] iDs    = newItem.IDs;
                Editor     editor = AfaDocData.ActiveDocData.Document.Editor;
                document.Editor.SetImpliedSelection(DocUtil.ExpandGroupObjectIds(AfaDocData.ActiveDocData.Document, iDs));
                ObjectIdCollection objectIds = null;
                if (iDs != null)
                {
                    objectIds = new ObjectIdCollection(iDs);
                }
                this.SetObjectIds(objectIds);
                editor.Regen();
            }
        }