Ejemplo n.º 1
0
        protected override async void NotifyPropertyChanged(string propertyName = null)
        {
            base.NotifyPropertyChanged(propertyName);
            if ((propertyName == nameof(Maid)) && (Maid != null) && Maid.Documents.Any())
            {
                Pictures  = Maid.Documents.Where(t => t.DocumentType.ShowAsPicture).ToObservableCollection();
                Documents = Maid.Documents.Where(t => !t.DocumentType.ShowAsPicture).ToObservableCollection();
            }

            if ((propertyName == nameof(SelectedPicture)) && (SelectedPicture != null))
            {
                var views =
                    Pictures.Select(t => new CarouselViewModel
                {
                    Image    = t.File,
                    IsActive = t == SelectedPicture
                }).ToObservableCollection();

                var selectedView = views.FirstOrDefault(t => t.Image == SelectedPicture.File);

                await Navigation.For <ImageViewerViewModel>()
                .WithParam(t => t.Views, views)
                .WithParam(t => t.SelectedItem, selectedView)
                .NavigateModal();
            }
        }