示例#1
0
        /// <summary>
        /// Deep search of a ruleapp for a specific def.  This code may not be suitable for proper looping and stamping
        /// of defs because the AsEnumerable misses some artifacts.  This will remain standalone for specific artifacts
        /// until it's decided that the ProcessChildren and this code can be refactored safely.  This code has the
        /// advantage of not requireing the member variable to hash duplicate hits and remove them from the
        /// collection.
        /// </summary>
        public RuleRepositoryDefBase FindDefDeep(RuleApplicationDef ruleapp, string guid)
        {
            RuleRepositoryDefBase found = null;

            if ((ruleapp != null) && (String.IsNullOrEmpty(guid) == false))
            {
                foreach (RuleRepositoryDefBase def in ruleapp.AsEnumerable())
                {
                    if (def.Guid.ToString().Equals(guid))
                    {
                        //Console.WriteLine("Found....");
                        found = def;
                        break;
                    }
                }
                //If we did not get a hit, let's look at category
                if (found == null)
                {
                    foreach (RuleRepositoryDefBase def in ruleapp.Categories)
                    {
                        if (def.Guid.ToString().Equals(guid))
                        {
                            //Console.WriteLine("Found....");
                            found = def;
                            break;
                        }
                    }
                }
            }
            return(found);
        }
示例#2
0
        private void LoadDefs()
        {
            defListBox.Items.Clear();

            var defs = from d in _ruleAppDef.AsEnumerable()
                       orderby d.Name
                       select d;

            defListBox.DisplayMember = "Name";
            defs.ForEach(d => defListBox.Items.Add(d));
        }