Releases: roubachof/Sharpnado.TaskLoaderView
Use TemplatedTaskLoader (implemented with ControlTemplate) with Snackbar
Builder for the CompositeTaskLoader
If you want to bind on the same snackbar loaders, and commands, there is now a nice builder.
With this change you can now use a TemplatedTaskLoader
and a snackbar and making them play nicely together.
CompositeNotifier = CompositeTaskLoaderNotifier.ForCommands()
.WithLoaders(Loader)
.WithCommands(BuyGameCommand, PlayTheGameCommand)
.Build();
And you bind the ShowLastError
on your snackbar:
<tlv:Snackbar Grid.Row="1"
Margin="15"
VerticalOptions="End"
BackgroundColor="White"
FontFamily="FontAtariSt"
IsVisible="{Binding CompositeNotifier.ShowLastError, Mode=TwoWay}"
Text="{Binding CompositeNotifier.LastError, Converter={StaticResource ExceptionToErrorMessageConverter}}"
TextColor="{StaticResource TextPrimaryColor}"
TextHorizontalOptions="Start" />
- Fix for the timed visibility when the snackbar (or a ITimedVisibilityText implementation) text is changing.
Fix behavior of TaskLoaderNotifier when two tasks are loaded sequentially
Semantic change
As of 2.4.0, considering the following scenario:
- You start to load a task using the Load command
- Then a second load is asked by calling the Load command while the first load hasn't finished yet
Then the result of the first load will be discarded and the second load will take priority.
BREAKING CHANGES
The task source given 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 boolean 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 RefreshCommand
will be called, it will pass automatically the isRefreshing boolean set to true to your task source.
Fixes
- Fix Snackbar
BackgroundColor
andCompositeLoader
behavior.
Snackbar with Composite Commands
Bind MVVM Async Commands to Snackar and Loading dialog.
SourceLink support
v2.1.1 enable source link
DataTemplate support
DataTemplate support
You can now add your customs views as View
or DataTemplate
.
If you choose the latest option, you can now specify your custom views in a ResourceDictionary
and set them in your TaskLoaderView
style.
Fixes
Expose TaskMonitor inner object
- Expose the
TaskMonitor
object to be able to await it and chain tasks. - Fixes a bad implementation of
TaskLoaderCommand
- Fixes crash when setting implicit style