Skip to content

Instantly share code, notes, and snippets.

@jasondown
Created August 3, 2021 08:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasondown/2aa9debb9f933c79bc2544995e811036 to your computer and use it in GitHub Desktop.
Save jasondown/2aa9debb9f933c79bc2544995e811036 to your computer and use it in GitHub Desktop.
private IImageRepository _imageRepository;
/// <summary>
/// Sets the image repository.
/// </summary>
/// <param name="repository">The repository.</param>
/// <exception cref="System.ArgumentNullException">repository</exception>
[ApplicationVisible]
public void SetImageRepository(IImageRepository repository)
{
if (repository == null)
throw new ArgumentNullException("repository");
if (_imageRepository != null)
{
_imageRepository.RequestItemImages -= OnRequestItemImages;
}
_imageRepository = repository;
_imageRepository.RequestItemImages += OnRequestItemImages;
_vm.SetImageRepository(repository);
}
/// <summary>
/// Occurs when a request item images is made.
/// </summary>
[ApplicationVisible]
public event EventHandler<ImageRequestEventArgs> RequestImages = delegate { };
private void OnRequestItemImages(object sender, ImageRequestEventArgs e)
{
RequestImages(new object(), e);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment