public IconManager(HttpClient httpClient, IIconCache cache, IconOptions options) { options.ThrowIfNull(); _httpClient = httpClient; _cache = cache; _options = options; }
protected IconOptions GetMergeOptions() { IconOptions ret = new IconOptions(); ret.SizeLimit = (Int32)FactoryOptions.Instance[IconSizeLimit]; ret.ClearOriginals = (Boolean)FactoryOptions.Instance[IconClearOriginal]; return(ret); }
public void SetOption(IconOptions state, bool value) { if (value) { this.options |= state; } else { this.options &= ~state; } }
protected IconOptions GetMergeOptions() { var ret = new IconOptions { SizeLimit = (int)FactoryOptions.Instance[IconSizeLimit], ClearOriginals = (bool)FactoryOptions.Instance[IconClearOriginal] }; return(ret); }
static void OnReady() { var icons = new IconOptions { header = "ui-icon-circle-arrow-e", headerSelected = "ui-icon-circle-arrow-s" }; new jQuery("#accordion").accordion(new AccordionOptions { icons = icons }); new jQuery("#toggle").button().toggle(e => new jQuery("#accordion").accordion("option", "icons", false), e => new jQuery("#accordion").accordion("option", "icons", icons) ); }
private void SetIcon(IconOptions icon) { switch (icon) { case IconOptions.People: elements.GetIconComboBox().SelectItemByName("People Icon"); break; default: elements.GetIconComboBox().SelectItemByName("No Icon"); break; } elements.GetSetIconButton().Invoke(); }
/// <summary> /// Gets the shell's file type name and icon. /// </summary> /// <param name="fileName">A file name. If <paramref name="useExistingFile"/> is true, then this should be /// the full path to an existing file. Otherwise, this can just be an extension (with leading period) to get /// generic file type information.</param> /// <param name="useExistingFile">If true, then the file specified by <paramref name="fileName"/> must exist, /// and its icon will be extracted, which can be unique for some file types like .exe and .ico. If false, then the /// <paramref name="fileName"/> can just be an extension, and the file type's standard icon will be used.</param> /// <param name="iconOptions">Options that determine the size and style of icon to get.</param> /// <param name="useIconHandle">If <paramref name="iconOptions"/> is None, then this should be null. /// Otherwise, this should be a delegate that converts the passed-in HICON into the desired icon type. /// In Windows Forms, this can be done with a delegate like: /// <c>hIcon => icon = (Icon)Icon.FromHandle(hIcon).Clone()</c> /// In WPF, the icon handle can be converted using the Imaging.CreateBitmapSourceFromHIcon method. /// <para/> /// Note: The icon handle will be destroyed automatically when this method returns, so the delegate /// must copy/clone the icon if it needs to use it later. /// </param> /// <returns>The shell's file type name (e.g., "Visual C# Source file" for a ".cs" file).</returns> public static string?GetFileTypeInfo(string fileName, bool useExistingFile, IconOptions iconOptions, Action <IntPtr>?useIconHandle) => NativeMethods.GetShellFileTypeAndIcon(fileName, useExistingFile, iconOptions, useIconHandle);
public Icon(IconOptions options) { this.options = options; }
internal static string?GetShellFileTypeAndIcon(string fileName, bool useExistingFile, IconOptions iconOptions, Action <IntPtr>?useIconHandle) { Conditions.RequireString(fileName, nameof(fileName)); Conditions.RequireArgument( (iconOptions == IconOptions.None && useIconHandle == null) || (iconOptions != IconOptions.None && useIconHandle != null), "The iconOptions and useIconHandle arguments must be compatible."); SHFILEINFO info = default; int cbFileInfo = Marshal.SizeOf(info); SHGFI flags = SHGFI.TypeName; int fileAttributes = 0; if (!useExistingFile) { flags |= SHGFI.UseFileAttributes; const int FILE_ATTRIBUTE_NORMAL = 128; const int FILE_ATTRIBUTE_DIRECTORY = 16; // http://stackoverflow.com/questions/1599235/how-do-i-fetch-the-folder-icon-on-windows-7-using-shell32-shgetfileinfo fileAttributes = iconOptions.HasFlag(IconOptions.Folder) ? FILE_ATTRIBUTE_DIRECTORY : FILE_ATTRIBUTE_NORMAL; } bool useIcon = iconOptions != IconOptions.None; if (useIcon) { flags |= SHGFI.Icon; // The Small and Large options are mutually exclusive. If they specify neither or both, then we'll default to small. if (iconOptions.HasFlag(IconOptions.Small) || !iconOptions.HasFlag(IconOptions.Large)) { flags |= SHGFI.SmallIcon; } else { flags |= SHGFI.LargeIcon; } if (iconOptions.HasFlag(IconOptions.ShellSize)) { flags |= SHGFI.ShellIconSize; } if (iconOptions.HasFlag(IconOptions.Open)) { flags |= SHGFI.OpenIcon; } if (iconOptions.HasFlag(IconOptions.Shortcut)) { flags |= SHGFI.LinkOverlay; } if (iconOptions.HasFlag(IconOptions.Selected)) { flags |= SHGFI.Selected; } } string?result = null; if (SHGetFileInfo(fileName, fileAttributes, out info, (uint)cbFileInfo, flags) != IntPtr.Zero) { result = info.szTypeName; if (useIcon && useIconHandle != null) { // The caller has to make a copy (e.g., Icon.FromHandle(hIcon).Clone()). useIconHandle(info.hIcon); DestroyIcon(info.hIcon); } } return(result); }
public void ClearState() { options &= ~(IconOptions)3; }
private string Write146_IconOptions(IconOptions v) { switch (v) { case IconOptions.ExtractIcons: return "ExtractIcons"; case IconOptions.DisableExtractSlowIcons: return "DisableExtractSlowIcons"; case IconOptions.ShowOverlayIcons: return "ShowOverlayIcons"; } return XmlSerializationWriter.FromEnum((long) v, new string[] { "ExtractIcons", "DisableExtractSlowIcons", "ShowOverlayIcons" }, new long[] { 1L, 2L, 4L }, "Nomad.FileSystem.Virtual.IconOptions"); }