private async Task UpdatePhotos() { _viewModel.IsBusy = true; if (_viewModel.PageNumber < 1) { _viewModel.PageNumber = 1; } // _viewModel.TagsCollection.Clear(); _viewModel.ItemsPerPage = Preferences.Get(Constants.PhotosPerPage, 8); PicturePage photoPage = await ProgenyService.GetPicturePage(_viewModel.PageNumber, _viewModel.ItemsPerPage, _viewModel.ViewChild, _viewModel.UserAccessLevel, _viewModel.UserInfo.Timezone, 1, _viewModel.TagFilter); if (photoPage.PicturesList != null) { _viewModel.PhotoItems.ReplaceRange(photoPage.PicturesList); _viewModel.PageNumber = photoPage.PageNumber; _viewModel.PageCount = photoPage.TotalPages; PhotosListView.ScrollTo(0); if (!string.IsNullOrEmpty(photoPage.TagsList)) { List <string> tagsList = photoPage.TagsList.Split(',').ToList(); tagsList.Sort(); foreach (string tagString in tagsList) { if (!string.IsNullOrEmpty(tagString)) { _viewModel.TagsCollection.Add(tagString); } } } } _viewModel.IsBusy = false; }
protected override async void OnAppearing() { base.OnAppearing(); var azureService = DependencyService.Get <IAzureService>(); if (!azureService.IsLoggedIn() && !Navigation.ModalStack.Any()) { await Navigation.PushModalAsync(new LoginPage(), false); } else { PhotosListView.BeginRefresh(); } }