Beispiel #1
0
 public FavIconDownloadJob(FavIconManager favIconManager, string url)
 {
     Guard.EmptyStringArgument(url, "url");
     Guard.NullArgument(favIconManager, "favIconManager");
     _favIconManager = favIconManager;
     _url            = url;
 }
Beispiel #2
0
        /// <summary>
        /// If the item passed in has a flag assigned, renders the flag to the newspaper as a flag image.
        /// </summary>
        /// <param name="item">Resource whose flag is to be rendered.</param>
        /// <param name="writer">Output text writer.</param>
        public static void RenderFlag(IResource item, TextWriter writer)
        {
            IResourceList flags = item.GetLinksFrom("Flag", "Flag");               // Flags assigned to this icon

            if (flags.Count == 0)
            {
                return;                 // No flags, no icons
            }
            IResource flag = flags[0];

            // Get path to the flag icon file
            Icon   icon      = Core.ResourceIconManager.GetResourceIconProvider(flag.Type).GetResourceIcon(flag);
            string sIconPath = FavIconManager.GetIconFile(icon, flag.OriginalId, "Flag", true);

            writer.WriteLine("<img class=\"Flag\" src=\"{0}\" width=\"{1}\" height=\"{2}\" alt=\"{3}\" title=\"{3}\" />", sIconPath, icon.Width, icon.Height, flag.DisplayName);
        }
Beispiel #3
0
        /// <summary>
        /// Creates a local file for the resource icon of the given resource, and returns a path to that file.
        /// </summary>
        /// <param name="item">Resource whose icon file path is to be retrieved. Icon provider will be used to get the icon on a per-resource basis.</param>
        /// <returns>Path to the icon file.</returns>
        public static string GetIconFileName(IResource item)
        {
            string relation = item.IsDeleted ? "Deleted" : (item.HasProp(Core.Props.IsUnread) ? "Unread" : "Read");

            return(FavIconManager.GetIconFile(Core.ResourceIconManager.GetResourceIconProvider(item.Type).GetResourceIcon(item), item.TypeId, relation, true));
        }