Sharpnado.TaskLoaderView 2.4.0

.NET Standard 2.0
Install-Package Sharpnado.TaskLoaderView -Version 2.4.0
dotnet add package Sharpnado.TaskLoaderView --version 2.4.0
<PackageReference Include="Sharpnado.TaskLoaderView" Version="2.4.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Sharpnado.TaskLoaderView --version 2.4.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Sharpnado.TaskLoaderView, 2.4.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install Sharpnado.TaskLoaderView as a Cake Addin
#addin nuget:?package=Sharpnado.TaskLoaderView&version=2.4.0

// Install Sharpnado.TaskLoaderView as a Cake Tool
#tool nuget:?package=Sharpnado.TaskLoaderView&version=2.4.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Free yourself from IsBusy=true!
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

Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows
.NET Core netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard2.0 netstandard2.1
.NET Framework net461 net462 net463 net47 net471 net472 net48
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen tizen40 tizen60
Xamarin.iOS xamarinios
Xamarin.Mac xamarinmac
Xamarin.TVOS xamarintvos
Xamarin.WatchOS xamarinwatchos
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Sharpnado.TaskLoaderView:

Package Downloads
Sharpnado.Presentation.Forms

Collection of Xamarin.Forms components. IMPORTANT: On platform projects, call SharpnadoInitializer.Initialize() after Xamarin.Forms.Forms.Init() and before LoadApplication(new App()). Pure Xamarin.Forms tabs: * Fixed tabs (android tabs style) * Scrollable tabs * Segmented tabs * Custom shadows (neumorphism ready) * Circle button in tab bar * Bottom bar tabs (ios tabs style) * Custom tabs (be creative just implement TabItem) * Independent ViewSwitcher Sharpnado.Shadows: * Add as many custom shadows as you like to any view (Android, iOS, UWP) * You can specify each shadow Color, Opacity, BlurRadius, and Offset * Simply implement Neumorphism * You can add one shadow, 3 shadows, 99 shadows, to any Xamarin.Forms element * Animate any of these property and make the shadows dance around your elements MaterialFrame: * AcrylicBlur mode * 3 Blur styles: Light, ExtraLight, Dark (UIVisualEffectView styles) * Acrylic mode * Dark mode * Light mode * Change modes dynamically * Performance (CALayer on ios, LayerDrawable on android) * Android: RealtimeBlurView from Tu Yimin (mmin18) The TaskLoaderView 2.0 handles all your task loading states: * Handles error with custom messages and icons * Handles empty states * Show snackbar errors for refresh scenarios (if data is already shown) * Handles retry with button * Support Xamarin.Forms.Skeleton * Can override any state views with your own custom ones HorizontalListView for Xamarin.Forms (close to a CollectionView): * Carousel layout * Column count * Snapping on first or middle element * Padding and item spacing * Handles NotifyCollectionChangedAction Add Remove and Reset actions * View recycling * RecyclerView on Android * UICollectionView on iOS Grid ListView (HorizontalListView with ListLayout set to Grid): * Column count * Drag And Drop * RefreshView support * Padding and item spacing * Handles NotifyCollectionChangedAction Add Remove and Reset actions * View recycling

Charpnado.Presentation.Forms

Collection of Xamarin.Forms components. IMPORTANT: On platform projects, call SharpnadoInitializer.Initialize() after Xamarin.Forms.Forms.Init() and before LoadApplication(new App()). Pure Xamarin.Forms tabs: * Fixed tabs (android tabs style) * Scrollable tabs * Segmented tabs * Custom shadows (neumorphism ready) * Circle button in tab bar * Bottom bar tabs (ios tabs style) * Custom tabs (be creative just implement TabItem) * Independent ViewSwitcher Sharpnado.Shadows: * Add as many custom shadows as you like to any view (Android, iOS, UWP) * You can specify each shadow Color, Opacity, BlurRadius, and Offset * Simply implement Neumorphism * You can add one shadow, 3 shadows, 99 shadows, to any Xamarin.Forms element * Animate any of these property and make the shadows dance around your elements MaterialFrame: * AcrylicBlur mode * 3 Blur styles: Light, ExtraLight, Dark (UIVisualEffectView styles) * Acrylic mode * Dark mode * Light mode * Change modes dynamically * Performance (CALayer on ios, LayerDrawable on android) * Android: RealtimeBlurView from Tu Yimin (mmin18) The TaskLoaderView 2.0 handles all your task loading states: * Handles error with custom messages and icons * Handles empty states * Show snackbar errors for refresh scenarios (if data is already shown) * Handles retry with button * Support Xamarin.Forms.Skeleton * Can override any state views with your own custom ones HorizontalListView for Xamarin.Forms (close to a CollectionView): * Carousel layout * Column count * Snapping on first or middle element * Padding and item spacing * Handles NotifyCollectionChangedAction Add Remove and Reset actions * View recycling * RecyclerView on Android * UICollectionView on iOS Grid ListView (HorizontalListView with ListLayout set to Grid): * Column count * Drag And Drop * RefreshView support * Padding and item spacing * Handles NotifyCollectionChangedAction Add Remove and Reset actions * View recycling

GitHub repositories (2)

Showing the top 2 popular GitHub repositories that depend on Sharpnado.TaskLoaderView:

Repository Stars
roubachof/Xamarin-Forms-Practices
Collection of good practices for Xamarin forms developement
roubachof/Sharpnado.CollectionView
A performant list view supporting: grid, horizontal and vertical layout, drag and drop, and reveal animations.
Version Downloads Last updated
2.4.0 3,654 6/23/2021
2.3.0 5,400 3/9/2021
2.2.1 6,723 12/18/2020
2.1.1 3,364 8/2/2020
2.1.0 242 7/30/2020
2.0.1 53,701 7/23/2020
2.0.0 40,021 1/14/2020

Fix Snackbar BackgroundColor and CompositeLoader behavior.
BREAKING CHANGE: 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());
The booleand 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.

Loader.Load(LoadItems);

public Task LoadItems(bool isRefreshing)
{
   if (isRefreshing || !_cache.ContainsItems())
   {
        _cache.InvalidateItems();
        var items = _httpService.GetItems()
        _cache.PutItems(items);
        return items;
   }

   return _cache.GetItems();
}

When the Refresh command will be called, it will pass automatically the isRefreshing boolean set to true to your task source.