예제 #1
0
        /// <summary>
        /// Initializes the services and commands.
        /// </summary>
        /// <param name="bibleRepository">A repository of <see cref="Bible"/>.</param>
        /// <param name="navigationService">A implementation of Navigation</param>
        public MainPageViewModel(IBibleRepository bibleRepository, INavigationService navigationService)
        {
            _bibleRepository = bibleRepository;

            LoadChaptersCommand = new DelegateCommand<Book>(LoadChapters);
            ShowChapterCommand = new DelegateCommand<Chapter>(ShowChapter);
        }
예제 #2
0
        /// <summary>
        /// This is the place you initialize your services and set default factory or default resolver for the view model locator.
        /// </summary>
        /// <param name="args">The same launch arguments passed when the app starts.</param>
        protected override Task OnInitializeAsync(IActivatedEventArgs args)
        {
            // New up the singleton data repository, and pass it the state service it depends on from the base class.
            _bibleRepository = new BibleRepository();

            // Register factory methods for the ViewModelLocator for each view model that takes dependencies so that you can pass in the
            // dependent services from the factory method here.
            ViewModelLocationProvider.Register(typeof(MainPage).ToString(), () => new MainPageViewModel(_bibleRepository, NavigationService));

            return base.OnInitializeAsync(args);
        }
        public MainMasterDetailPageViewModel(IBibleRepository repository)
        {
            ItemSelectedCommand = new Command <SelectedItemChangedEventArgs>(OnItemSelected);

            ListItemSource = new ObservableCollection <MasterPageItem>();
            ListItemSource.Add(new MasterPageItem()
            {
                Title = "Buscar", TargetType = typeof(PageSearch)
            });
            ListItemSource.Add(new MasterPageItem()
            {
                Title = "Biblia", TargetType = typeof(PageBibleBooks)
            });
            ListItemSource.Add(new MasterPageItem()
            {
                Title = "Configuracion", TargetType = typeof(PageConfiguration)
            });

            var books = repository.GetBooksAsync().Result;
        }
예제 #4
0
 public BibleManager(IOptions <List <Bible> > _bibleList, IBibleRepository bibleRepository)
 {
     this._bibleList  = _bibleList;
     _bibleRepository = bibleRepository;
 }