[Spec] ImageSourceHandler
- Dominant language
- C#
- Stars
- 23.3k
- Forks
- 2k
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 297
Description
# [ImageSource]
Create a service that handles the ImageSource logic on shared code based [on this discussion](https://twitter.com/mattleibow/status/1302407836748611586) between me, @PureWeen, and @mattleibow.
The general idea is to have an ImageSource handler class that will handle all ImageSource updates in the shared layer and reflects them to the Control.
# API
## [ IImageSourceHandler]
```csharp
interface IImageSourceHandler
{
ImageSource Current {get;}
ImageSource LoadingPlaceholder {get;}
ImageSource ErrorPlaceholder {get;}
ImageSource Desired {get;}
// Those can be internals
Action OnLoadingStarted {get;}
Action OnSourceChanged {get;}
Action OnLoadingFailed {get;}
Action OnLoadingCompleted {get;}
}
```
### Properties
| API | Description |
| ------------- | ------------- |
|Current | This will be the current ImageSource for displayed Image. |
|LoadingPlaceholder | ImageSource that will be presented while we load/download the Desired ImageSource |
|ErrorPlaceholder | ImageSource that will be presented if something goes wrong with the Desired ImageSource |
|Desired | The ImageSource that the user wants to present in the control |
### Events
| API | Description |
| ------------- | ------------- |
|OnLoadingStarted | Action that will be fired when we start to load the Desired ImageSource |
|OnSourceChanged | Action that will be fired when Current value changes |
|OnLoadingFailed | Action that will be fired when something goes wrong during the Loading process |
|OnLoadingCompleted | Action that will be fired when we loaded the Desired ImageSource successfully |
# Scenarios
```xml
```
# Backward Compatibility
Minimum API levels?
Breaking changes?
Unsupported platforms?
# Difficulty: medium
Contributor guide
Assessment
This issue has not been assessed yet.