예제 #1
0
 public void OnBookChanged(Book book, BookEventArgs.BookState bookState, int? progress)
 {
     BookChanged?.Invoke(this, new BookEventArgs { Book = book, State = bookState, Progress = progress });
 }
예제 #2
0
        private void EditPopup_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
        {
            if (cbox.IsChecked == false)
            {
                _viewmodel.SelectedBook.DatePublished = null;
            }

            _viewmodel.UpdateBook(_viewmodel.SelectedBook);
            var a = new BookEventArgs
            {
                Book = _viewmodel.SelectedBook,
                State = BookEventArgs.BookState.Updated
            };
            _viewmodel.BookChanged(this, a);
            tbutton.IsChecked = false;
        }
예제 #3
0
        private void ggview_Drop(object sender, DragEventArgs e)
        {
            EnableScroll();
            object gridSource;
            e.Data.Properties.TryGetValue("gridSource", out gridSource);

            if (gridSource == sender)
                return;

            object sourceItem;
            e.Data.Properties.TryGetValue("item", out sourceItem);
            if (sourceItem == null)
                return;

            _viewmodel.ShelfBrush = _shelfBrushColor;
            _viewmodel.GridBrush = _gridBrushColor;

            var book = (Book) sourceItem;
            _viewmodel.ShelfBooks.Add(book);
            book.Shelf = true;
            var a = new BookEventArgs
            {
                Book = book,
                State = BookEventArgs.BookState.Updated
            };
            _viewmodel.BookChanged(this, a);
            _viewmodel.UpdateBook(book);
            ShellViewModel.ShowMessage("Added to shelf", null);
        }
예제 #4
0
        private void gview_Drop(object sender, DragEventArgs e)
        {
            viewmodel.BooksScroll = ScrollMode.Enabled;

            object gridSource;
            e.Data.Properties.TryGetValue("gridSource", out gridSource);

            if (gridSource == sender)
                return;

            object sourceItem;
            e.Data.Properties.TryGetValue("item", out sourceItem);
            if (sourceItem == null)
                return;

               // viewmodel.ShelfBrush = _shelfBrushColor;
               // viewmodel.GridBrush = _gridBrushColor;

            //Remove it from shelf
            var book = (Book)sourceItem;
            viewmodel.ShelfBooks.Remove(book);
            book.Shelf = false;

            var a = new BookEventArgs();
            a.Book = book;
            a.State = BookEventArgs.BookState.Updated;
            viewmodel.BookChanged(this, a);
            viewmodel.UpdateBook(book);
        }