Пример #1
0
        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;
                    }
                }
            }
        }
Пример #2
0
        public void GetInfo(object item, ItemInfo info)
        {
            IListable listable = item.As <IListable>();

            if (listable != null)
            {
                listable.GetInfo(info);
                return;
            }

            IResource resource = item.As <IResource>();

            if (resource != null && !item.Is <Game>())
            {
                info.Label      = Path.GetFileName(resource.Uri.LocalPath);
                info.ImageIndex = info.GetImageList().Images.IndexOfKey(Sce.Atf.Resources.ResourceImage);
                return;
            }

            // If the object has a name use it as the label (overriding whatever may have been set previously)
            INameable nameable = Adapters.As <INameable>(item);

            if (nameable != null)
            {
                info.Label = nameable.Name;
            }
        }