/// <summary>Attempts to load the icon if it has not already been loaded.</summary>
 public void LoadIcon()
 {
     if (cacheState == IconCacheState.NotCached)
     {
         cacheState = IconCacheState.Caching;
         IconCache.CacheFileTypeAsync(Extension, OnCacheIconAndTypeName);
     }
 }
 /// <summary>The callback for asynchronously caching the file type icon and type name.</summary>
 ///
 /// <param name="iconName">The resulting icon and type name.</param>
 private void OnCacheIconAndTypeName(IIconAndName iconName)
 {
     if (iconName != null)
     {
         Icon     = iconName.Icon;
         TypeName = iconName.Name;
     }
     // Even if "I failed, I failed, I failed", we're not gonna reattempt this
     cacheState = IconCacheState.Cached;
 }
 /// <summary>Constructs an <see cref="ExtensionItemViewModel"/>.</summary>
 ///
 /// <param name="extensions">The collection containing this item.</param>
 /// <param name="model">The model that this view model item represents.</param>
 public ExtensionItemViewModel(ExtensionItemViewModelCollection extensions, ExtensionItem model)
 {
     this.extensions = extensions;
     Model           = model;
     icon            = IconCache.FileIcon;
     if (IsEmptyExtension || Extension.Contains(" "))
     {
         // Extensions with spaces have no rights, so says Windows
         typeName   = "File";
         cacheState = IconCacheState.Cached;
     }
     else
     {
         typeName = model.Extension.TrimStart('.').ToUpper() + " File";
         if (CacheMode >= IconCacheMode.FileType)
         {
             LoadIcon();
         }
     }
     HookEvents();
 }