示例#1
0
        static public IReflectInsight Add(RIInstance instance)
        {
            lock (FInstances)
            {
                // this method checks to see if the RI already exists
                // and only updates the category, bkColor and destination binding values.
                // if it doesn't exist then it creates a new RI and adds it to the list
                RILogManagerNode node = GetNode(instance.Name);
                if (node != null)
                {
                    // if the RI already exists, only change the category, color and destination binding groups
                    lock (node.Instance)
                    {
                        node.Instance.ClearDestinationBindingGroup();
                        node.Instance.Category  = instance.Category;
                        node.Instance.BackColor = RIPastelBackColor.GetColorByName(instance.BkColor);
                        node.Instance.SetDestinationBindingGroup(instance.DestinationBindingGroup);
                    }

                    return(node.Instance);
                }

                // create a new instance and add it
                return(Add(instance.Name, CreateInstance(instance)));
            }
        }
示例#2
0
        static private IReflectInsight CreateInstance(RIInstance instance)
        {
            IReflectInsight ri = new ReflectInsight(instance.Category);

            ri.BackColor = RIPastelBackColor.GetColorByName(instance.BkColor);
            ri.SetDestinationBindingGroup(instance.DestinationBindingGroup);

            return(ri);
        }