/// <summary> /// Returns a unique image that is loaded asynchronously. /// This image is used as default as long as the loading is not done and in case it fails. /// </summary> public ItemImage AsDefaultForUniqueImage(ItemImageService itemImageService, string uniqueName) { return(new ItemImage( ImageSource.Result, itemImageService.LoadItemImageAsync(uniqueName, ImageSource.Task), "Loading of unique item image failed" )); }
/// <summary> /// Represents an image for an item base. First the classes's image will be loaded synchronously, /// which is then used as the image until the base item's image is loaded asynchronously. /// </summary> public ItemImage(ItemImageService itemImageService, string baseName, ItemClass baseClass) { var defaultImage = itemImageService.LoadDefaultImage(baseClass); ImageSource = NewImageSourceTask( itemImageService.LoadItemImageAsync(baseName, Task.FromResult(defaultImage)), "Loading of base item image failed", defaultImage ); }
/// <summary> /// Represents an image for an item base. First the group's image will be loaded synchronously, /// which is then used as the image until the base item's image is loaded asynchronously. /// </summary> public ItemImage(ItemImageService itemImageService, string baseName, ItemGroup baseGroup) { var defaultImage = itemImageService.LoadDefaultImage(baseGroup); ImageSource = NewImageSourceTask( itemImageService.LoadItemImageAsync(baseName, defaultImage), "Loading of base item image failed", defaultImage ); }