Пример #1
0
 public LibraryViewModel(IMetadataRepository repository, LibraryPageItemViewModel.Factory itemFactory) : base("library")
 {
     this.repository  = repository;
     this.itemFactory = itemFactory;
     DisplayName      = "Library";
     //TODO: find a way to fix this getawaiter
     pagination    = repository.GetAllEntriesAsync().GetAwaiter().GetResult();
     PageSelection = Enumerable.Range(1, PageCount).ToList();
 }
        public LibraryPageViewModel(
            IPage <IMetadata> page,
            LibraryPageItemViewModel.Factory factory,
            Conductor <TabViewModelBase> .Collection.OneActive conductor)
        {
            if (page == null)
            {
                PageVisibility  = Visibility.Collapsed;
                EmptyVisibility = Visibility.Visible;
                return;
            }

            PageVisibility  = Visibility.Visible;
            EmptyVisibility = Visibility.Hidden;

            Page = page.Select(m => factory.Create(m, conductor)).ToImmutableList();
        }