public static bool TryCreateImageSource(object source, int width, int height, out ImageSource imageSource) { foreach (var factory in _imageSourceFactories) { imageSource = factory(source, width, height); if (imageSource != null) return true; } imageSource = null; return false; }
/// <summary> /// Creates a new FanArtImageSource instance for exposing it using <see cref="ImageSource"/>. /// </summary> private void SetImageSource() { InitProviders(); FanArtImageSource imageSource; foreach (IFanartImageSourceProvider provider in _providerList) { if (provider.TryCreateFanartImageSource(SelectedItem, out imageSource)) { ImageSource = imageSource; FanArtMediaType = imageSource.FanArtMediaType; FanArtName = imageSource.FanArtName; return; } } ImageSource = new FanArtImageSource { FanArtMediaType = FanArtMediaTypes.Undefined, FanArtName = string.Empty }; }
/// <summary> /// Creates a new FanArtImageSource instance for exposing it using <see cref="ImageSource"/>. /// </summary> private void SetImageSource() { ImageSource = new FanArtImageSource { FanArtMediaType = FanArtMediaType, FanArtName = FanArtName, }; }