Exemplo n.º 1
0
 /// <summary>
 /// Opens the reading page on the selected book if bottombar or its associated
 /// items are not also open, if they are, it closes them
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void LibraryListView_Tapped(object sender, TappedRoutedEventArgs e)
 {
     if (BottomBar.Visibility == Visibility.Visible ||
         DetailsGrid.Visibility == Visibility.Visible ||
         BookNameBox.Visibility == Visibility.Visible ||
         AuthorNameBox.Visibility == Visibility.Visible)
     {
         CloseAppBarAndDetailsIfOpen();
     }
     else
     {
         var listViewItem = sender as ListViewItem;
         if (listViewItem != null)
         {
             _ourBook = listViewItem.DataContext as BookModel;
         }
         LibraryListView.SelectedItem = null;
         if (_ourBook == null)
         {
             return;
         }
         if (_ourBook.IsStarted != true)
         {
             _ourBook.IsStarted = true;
             LibrarySource.RecentReads.Add(_ourBook);
         }
         _ourBook.OpenedRecentlyTime = DateTime.Now.Ticks;
         LibrarySource.SortBooksByAccessDate();
         Frame.Navigate(typeof(ReadingPage), _ourBook);
     }
 }
Exemplo n.º 2
0
        private void LibraryGridView_Tapped(object sender, TappedRoutedEventArgs e)
        {
            var gridViewItem = sender as GridViewItem;

            if (gridViewItem != null)
            {
                ourBook = gridViewItem.DataContext as BookModel;
            }
            this.LibraryGridView.SelectedItem = null;
            if (ourBook != null)
            {
                if (ourBook.IsStarted != true)
                {
                    ourBook.IsStarted = true;
                    this.LibrarySource.RecentReads.Add(ourBook);
                }
                ourBook.OpenedRecentlyTime = DateTime.Now.Ticks;
                LibrarySource.SortBooksByAccessDate();
                this.Frame.Navigate(typeof(ReadingPage), ourBook);
            }
        }