public void GetInfo(object item, ItemInfo info)
        {
            ILayer layer = Adapters.As<ILayer>(item);
            if (layer != null)
            {
                info.Label = layer.Name;
                info.HasCheck = true;
                info.SetCheckState(GetCheckState(layer));
            }
            else
            {               
                IReference<IGameObject> reference = Adapters.As<IReference<IGameObject>>(item);
                if (reference != null)
                {
                    IListable listable = reference.As<IListable>();
                    listable.GetInfo(info);
                    //INameable nameable = Adapters.As<INameable>(reference.Target);
                    //if (nameable != null && !string.IsNullOrEmpty(nameable.Name))
                    //    info.Label = nameable.Name;

                    info.IsLeaf = true;
                    IVisible iVisible = GetIVisible(item);
                    if (iVisible != null)
                    {
                        info.HasCheck = true;
                        info.Checked = iVisible.Visible;
                    }
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// Fills in or modifies the given display info for the item</summary>
        /// <param name="item">Item</param>
        /// <param name="info">Display info to update</param>
        public void GetInfo(object item, ItemInfo info)
        {
            LayerFolder layer = item.As<LayerFolder>();
            if (layer != null)
            {
                info.Label = layer.Name;
                info.HasCheck = true;
                info.SetCheckState(GetCheckState(layer));
                return;
            }

            ElementRef reference = item.As<ElementRef>();
            if (reference != null)
            {
                Element element = reference.Element;
                if (element != null)
                {
                    info.Label = element.Id;
                    info.IsLeaf = true;
                }

                IVisible iVisible = GetIVisible(item);
                if (iVisible != null)
                {
                    info.HasCheck = true;
                    info.Checked = iVisible.Visible;
                }
                return;
            }
        }