refreshing

This commit is contained in:
Kyle Spearrin 2019-04-24 23:37:47 -04:00
parent be5fd8381f
commit 18ff6c7976
2 changed files with 21 additions and 9 deletions

View file

@ -81,9 +81,9 @@
ItemsSource="{Binding GroupedItems}" ItemsSource="{Binding GroupedItems}"
VerticalOptions="FillAndExpand" VerticalOptions="FillAndExpand"
HasUnevenRows="true" HasUnevenRows="true"
RefreshCommand="{Binding LoadCommand}" RefreshCommand="{Binding RefreshCommand}"
IsPullToRefreshEnabled="true" IsPullToRefreshEnabled="true"
IsRefreshing="{Binding Loading, Mode=OneWay}" IsRefreshing="{Binding Refreshing}"
CachingStrategy="RecycleElement" CachingStrategy="RecycleElement"
ItemTemplate="{StaticResource listItemDataTemplateSelector}" ItemTemplate="{StaticResource listItemDataTemplateSelector}"
IsGroupingEnabled="True" IsGroupingEnabled="True"

View file

@ -13,11 +13,12 @@ namespace Bit.App.Pages
{ {
public class GroupingsPageViewModel : BaseViewModel public class GroupingsPageViewModel : BaseViewModel
{ {
private bool _loading = false; private bool _refreshing;
private bool _loaded = false; private bool _loading;
private bool _showAddCipherButton = false; private bool _loaded;
private bool _showNoData = false; private bool _showAddCipherButton;
private bool _showList = false; private bool _showNoData;
private bool _showList;
private string _noDataText; private string _noDataText;
private List<CipherView> _allCiphers; private List<CipherView> _allCiphers;
@ -33,9 +34,14 @@ namespace Bit.App.Pages
_collectionService = ServiceContainer.Resolve<ICollectionService>("collectionService"); _collectionService = ServiceContainer.Resolve<ICollectionService>("collectionService");
_syncService = ServiceContainer.Resolve<ISyncService>("syncService"); _syncService = ServiceContainer.Resolve<ISyncService>("syncService");
Loading = true;
PageTitle = AppResources.MyVault; PageTitle = AppResources.MyVault;
GroupedItems = new ExtendedObservableCollection<GroupingsPageListGroup>(); GroupedItems = new ExtendedObservableCollection<GroupingsPageListGroup>();
LoadCommand = new Command(async () => await LoadAsync()); RefreshCommand = new Command(async () =>
{
Refreshing = true;
await LoadAsync();
});
AddCipherCommand = new Command(() => { /* TODO */ }); AddCipherCommand = new Command(() => { /* TODO */ });
} }
@ -55,6 +61,11 @@ namespace Bit.App.Pages
public List<Core.Models.View.CollectionView> Collections { get; set; } public List<Core.Models.View.CollectionView> Collections { get; set; }
public List<TreeNode<Core.Models.View.CollectionView>> NestedCollections { get; set; } public List<TreeNode<Core.Models.View.CollectionView>> NestedCollections { get; set; }
public bool Refreshing
{
get => _refreshing;
set => SetProperty(ref _refreshing, value);
}
public bool Loading public bool Loading
{ {
get => _loading; get => _loading;
@ -86,7 +97,7 @@ namespace Bit.App.Pages
set => SetProperty(ref _showList, value); set => SetProperty(ref _showList, value);
} }
public ExtendedObservableCollection<GroupingsPageListGroup> GroupedItems { get; set; } public ExtendedObservableCollection<GroupingsPageListGroup> GroupedItems { get; set; }
public Command LoadCommand { get; set; } public Command RefreshCommand { get; set; }
public Command AddCipherCommand { get; set; } public Command AddCipherCommand { get; set; }
public async Task LoadAsync() public async Task LoadAsync()
@ -135,6 +146,7 @@ namespace Bit.App.Pages
ShowList = !ShowNoData; ShowList = !ShowNoData;
Loaded = true; Loaded = true;
Loading = false; Loading = false;
Refreshing = false;
} }
} }