Exemplo n.º 1
0
        public Icon GetResourceIcon(IResource res)
        {
            ResourceTypeIconConfiguration cfg = (ResourceTypeIconConfiguration)_resourceTypeMap [res.Type];

            if (cfg == null)
            {
                return(null);
            }

            string iconName = cfg.GetResourceIconName(res);

            return(LoadIconIfNew(iconName));
        }
Exemplo n.º 2
0
        public Icon GetDefaultIcon(string resType)
        {
            ResourceTypeIconConfiguration cfg = (ResourceTypeIconConfiguration)_resourceTypeMap [resType];

            if (cfg == null)
            {
                return(null);
            }

            string iconName = cfg.GetDefaultIconName();

            return(LoadIconIfNew(iconName));
        }
Exemplo n.º 3
0
        public Icon[] GetOverlayIcons(IResource res)
        {
            ResourceTypeIconConfiguration cfg = (ResourceTypeIconConfiguration)_resourceTypeMap [res.Type];

            if (cfg == null)
            {
                return(null);
            }

            string[] overlayIconNames = cfg.GetOverlayIconNames(res);
            if (overlayIconNames == null || overlayIconNames.Length == 0)
            {
                return(null);
            }

            Icon[] overlayIcons = new Icon [overlayIconNames.Length];
            for (int i = 0; i < overlayIconNames.Length; i++)
            {
                overlayIcons [i] = LoadIconIfNew(overlayIconNames [i]);
            }
            return(overlayIcons);
        }
Exemplo n.º 4
0
        private Hashtable _iconMap         = new Hashtable();  // icon name -> icon

        public ConfigurableIconProvider(Assembly pluginAssembly, XmlNode node)
        {
            _pluginAssembly = pluginAssembly;
            XmlAttribute attrNS = node.Attributes ["namespace"];

            _defaultNamespace = (attrNS == null) ? "" : attrNS.Value;

            foreach (XmlNode typeNode in node.SelectNodes("icons"))
            {
                ResourceTypeIconConfiguration cfg = new ResourceTypeIconConfiguration(typeNode);
                _resourceTypeMap [cfg._resType] = cfg;
            }

            // shortcut for resource types which have only one icon
            foreach (XmlNode iconNode in node.SelectNodes("icon"))
            {
                ResourceTypeIconConfiguration cfg      = new ResourceTypeIconConfiguration(iconNode);
                ResourceIconInstance          instance = new ResourceIconInstance(iconNode);
                cfg.AddIconInstance(instance);
                _resourceTypeMap [cfg._resType] = cfg;
            }
        }