コード例 #1
0
        private void RepresentationPropertyPage_Load(object sender, EventArgs e)
        {
            int num;
            IRepresentationRule  rule;
            IRepresentationRules representationRules = this.m_pRepentation.RepresentationClass.RepresentationRules;

            representationRules.Reset();
            representationRules.Next(out num, out rule);
            while (rule != null)
            {
                string name = representationRules.get_Name(num);
                this.comboBox1.Items.Add(new RepresentationRuleWrap(num, name, rule));
            }
        }
コード例 #2
0
        /// <summary>
        /// Check if a rep rule for the selected SymbolIDCode exists and if so returns it
        /// Ignore Case in check for Rule Name (since Rep Rules ignore case)
        /// </summary>
        /// <returns>-1 if not found</returns>
        private int getRepRuleIdForSidc(IRepresentationClass repClass, string sidc)
        {
            int returnRepRuleId = -1;

            if ((symbolCreator == null) || (repClass == null))
            {
                return(-1);
            }

            string symboName = symbolCreator.GetRuleNameFromSidc(sidc).ToUpper();

            if (string.IsNullOrEmpty(symboName))
            {
                Console.WriteLine("Empty Name returned for SIDC: " + sidc);
                return(-1);
            }

            IRepresentationRules repRules = repClass.RepresentationRules;

            repRules.Reset();

            int ruleID = 0;
            IRepresentationRule rule;

            repRules.Next(out ruleID, out rule);

            while (rule != null)
            {
                if (rule != null)
                {
                    string ruleName = repRules.get_Name(ruleID).ToUpper();

                    if (ruleName == symboName)
                    {
                        returnRepRuleId = ruleID;
                        break;
                    }
                }

                repRules.Next(out ruleID, out rule);
            }

            if (returnRepRuleId == -1)
            {
                System.Diagnostics.Debug.WriteLine("Existing Rule not found for " + symboName);
            }

            return(returnRepRuleId);
        }