Add app refresh

This commit is contained in:
2019-04-27 13:49:02 +02:00
parent c6888550b6
commit 29329ee303
2 changed files with 13 additions and 2 deletions

View File

@@ -11,13 +11,15 @@
<ContentPage.Content>
<AbsoluteLayout>
<!--List-->
<ListView AbsoluteLayout.LayoutBounds="0, 0, 1, 1"
<ListView x:Name="List"
AbsoluteLayout.LayoutBounds="0, 0, 1, 1"
AbsoluteLayout.LayoutFlags="All"
ItemsSource="{Binding Plants}"
SelectionMode="None"
IsPullToRefreshEnabled="True"
RowHeight="{OnPlatform Android=85}"
SeparatorVisibility="None"
IsPullToRefreshEnabled="True"
Refreshing="ListView_Refreshing"
ItemTapped="ListView_ItemTapped">
<ListView.ItemTemplate>
<DataTemplate>

View File

@@ -48,5 +48,14 @@ namespace PlantBox.Client.Forms
{
}
private async void ListView_Refreshing(object sender, EventArgs e)
{
var homeViewModel = (HomeViewModel)BindingContext;
await Task.Run(() => homeViewModel.Plants = homeViewModel.LoadPlants(App.Settings.IDs));
List.EndRefresh();
}
}
}