Skip to content

[Spec] ImageSourceHandler #480

Open
Open
@pictos

Description

@pictos

[ImageSource]

Create a service that handles the ImageSource logic on shared code based on this discussion 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]

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

<Image Desired="ImageThatIWant"
       LoadingPlaceholder="LoadingTheDesiredSource"
       ErrorPlaceholder="ImageIfSomethingGoesWrong" />

Backward Compatibility

Minimum API levels?
Breaking changes?
Unsupported platforms?

Difficulty: medium

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions