コード例 #1
0
 /// <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(IconAndName 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;
 }
コード例 #2
0
        /// <summary>Constructs the see <see cref="DriveItemViewModel"/>.</summary>
        ///
        /// <param name="drives">The collection containing this drive item view model.</param>
        /// <param name="model">The model that this view model represents.</param>
        public DriveItemViewModel(DriveItemViewModelCollection drives, DriveItem model)
        {
            this.drives = drives;
            Model       = model;

            IconAndName iconName = IconCache.CacheIconAndDisplayName(Name);

            if (iconName != null)
            {
                Icon        = iconName.Icon;
                DisplayName = iconName.Name;
            }
            else
            {
                Icon        = IconCache.VolumeIcon;
                DisplayName = $"({PathUtils.TrimSeparatorEnd(Name)})";
            }
        }