Beispiel #1
0
        OnBnEnumSnoop(object sender, EventArgs e)
        {
            Hashtable enumMap = new Hashtable();

            // TBD: iterating over the Parameters using basic reflection gives us lots
            // of duplicates (not sure why).  Instead, use Enum.GetNames() which will return
            // only unique Enum names.  Then go backward to get the actual BuiltinParam Enum.
            // See TestElements.ParameterEnums() and TestElements.ParameterEnumsNoDup() for an
            // explanation of what is going on.  (jma - 07/24/06)
            string [] strs = System.Enum.GetNames(typeof(BuiltInParameter));
            foreach (string str in strs)
            {
                // look up the actual enum from its name
                BuiltInParameter paramEnum = (BuiltInParameter)System.Enum.Parse(typeof(BuiltInParameter), str);

                // see if this Element supports that parameter
                Parameter tmpParam = m_elem.get_Parameter(paramEnum);

                if (tmpParam != null)
                {
                    enumMap.Add(str, tmpParam);
                }
            }

            RevitLookup.Snoop.Forms.ParamEnumSnoop dbox = new RevitLookup.Snoop.Forms.ParamEnumSnoop(enumMap);
            dbox.ShowDialog();
        }
Beispiel #2
0
        OnBnEnumSnoop(object sender, EventArgs e)
        {                           
            Hashtable    enumMap        = new Hashtable();                       
            
                // TBD: iterating over the Parameters using basic reflection gives us lots
                // of duplicates (not sure why).  Instead, use Enum.GetNames() which will return
                // only unique Enum names.  Then go backward to get the actual BuiltinParam Enum.
                // See TestElements.ParameterEnums() and TestElements.ParameterEnumsNoDup() for an
                // explanation of what is going on.  (jma - 07/24/06)
            string [] strs = System.Enum.GetNames(typeof(BuiltInParameter));
            foreach (string str in strs) {
                    // look up the actual enum from its name
                BuiltInParameter paramEnum = (BuiltInParameter)System.Enum.Parse(typeof(BuiltInParameter), str);
                
                    // see if this Element supports that parameter
                Parameter tmpParam = m_elem.get_Parameter(paramEnum);
                
                if (tmpParam != null) {                                   
                    enumMap.Add(str, tmpParam);
                }
            }

            RevitLookup.Snoop.Forms.ParamEnumSnoop dbox = new RevitLookup.Snoop.Forms.ParamEnumSnoop(enumMap);
            dbox.ShowDialog();                       
        }