Info
Version: | 2.4.0 |
Author(s): | Jean-Marie Alfonsi |
Last Update: | Wednesday, June 23, 2021 |
.NET Fiddle: | Create the first Fiddle |
Project Url: | https://github.com/roubachof/Sharpnado.TaskLoaderView |
NuGet Url: | https://www.nuget.org/packages/Sharpnado.TaskLoaderView |
Install
Install-Package Sharpnado.TaskLoaderView
dotnet add package Sharpnado.TaskLoaderView
paket add Sharpnado.TaskLoaderView
Sharpnado.TaskLoaderView Download (Unzip the "nupkg" after downloading)
Dependencies
- Sharpnado.TaskMonitor(>= 1.0.1)
- Xamarin.Forms(>= 3.6.0.220655)
Tags
The `TaskLoaderView` is a UI component that handles all your UI loading state (Loading, Error, Result, Notification), and removes all the pain of async loading from your view models (try catch / async void / IsBusy / HasErrors / base view models / ...) thanks to its brother the `TaskLoaderNotifier`.
BREAKING CHANGE Version 2.4.0:
The task source given to to TaskLoaderNotifier is now a Func{bool, Task} (or a Func{bool, Task{T}}) instead of a Func{Task}.
You can simply change your calls from Loader.Load(() => InitializeAsync()) to Loader.Load(_ => InitializeAsync()) to ignore it if you like.
The boolean that is passed now to your task source is a boolean indicating if the notifier is refreshing.
You can use it for invalidating your cache, for example:
public Task LoadItems(bool isRefreshing)
{
if (isRefreshing || !_cache.ContainsItems())
{
_cache.InvalidateItems();
var items = _httpService.GetItems()
_cache.PutItems(items);
return items;
}
return _cache.GetItems();
}
Featuring:
* Default views for all loading states (Loading, Error, Success, Notification, Refresh)
* Snackbar component
* Compose notifiers with CompositeTaskLoaderNotifier
* Stylable views including fonts, accent color, error images, ...
* Any states are overridable with user custom views and easily positionned with AbsoluteLayout properties
* Support for Xamarin.Forms.Skeleton nuget package
* Support for refresh scenarios, and error while refreshing with the ErrorNotificationView
* Supports Async mvvm ICommand through TaskLoaderCommand
* Supports loading task on demand with the NotStarted state
* TaskLoaderNotifier for the ViewModel side taking care of all the error handling and the IsBusy nonsense.