示例#1
2
        private void OnSubmitAddNewBook()
        {
            if (null != this.notification)
            {
                Book book = new Book();
                book.BookName = BookName;
                book.CoverImg = BookCoverImg;
                book.MediaFile = BookMediaPath;
                book.Category = Book.ParseBookCategory(this.BookCategory);
                book.BookUri = BookUri;

                this.notification.AddedBook = book;
                this.notification.Confirmed = true;
            }
            this.FinishInteraction();
        }
示例#2
0
 private void FocusBookChanged(Book book)
 {
     if (null != book)
     {
         BookMedia = book.MediaFile;
     }
     else
     {
         BookMedia = "";
     }
 }
示例#3
0
 private void FocusBookChanged(Book book)
 {
     if (null != book)
     {
         BookCover = book.CoverImg;
     }
     else
     {
         BookCover = "";
     }
 }
示例#4
0
 private void FocusBookChanged(Book book)
 {
     if (null != book)
     {
         BookUri = book.BookUri;
     }
     else
     {
         BookUri = "";
     }
 }
示例#5
0
        private static bool LoadBooks()
        {
            if (Properties.Settings.Default.MyBooks.Length < 1)
            {
                _Books = new List<Book>();
                Book book = new Book();
                book.BookName = "WPF高级编程";
                book.CoverImg = Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase, "res", "wpf1.jpg");
                book.MediaFile = Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase, "res", "wpf.mp4");
                book.Category = Book.BookCategory.ScienceTech;
                _Books.Add(book);

                book = new Book();
                book.BookName = "WPF高级编程";
                book.CoverImg = Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase, "res", "wpf1.jpg");
                book.MediaFile = Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase, "res", "wpf.mp4");
                book.Category = Book.BookCategory.ScienceTech;
                _Books.Add(book);

                book = new Book();
                book.BookName = "WPF高级编程";
                book.CoverImg = Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase, "res", "wpf1.jpg");
                book.MediaFile = Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase, "res", "wpf.mp4");
                book.Category = Book.BookCategory.ScienceTech;
                _Books.Add(book);

                book = new Book();
                book.BookName = "WPF高级编程";
                book.CoverImg = Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase, "res", "wpf1.jpg");
                book.MediaFile = Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase, "res", "wpf.mp4");
                book.Category = Book.BookCategory.ScienceTech;
                _Books.Add(book);

                book = new Book();
                book.BookName = "WPF高级编程";
                book.CoverImg = Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase, "res", "wpf1.jpg");
                book.MediaFile = Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase, "res", "wpf.mp4");
                book.Category = Book.BookCategory.ScienceTech;
                _Books.Add(book);

            }
            else
            {
                ParseBooksItems(Properties.Settings.Default.MyBooks);
            }

            return true;
        }
示例#6
0
 private void OnViewBookInfo(Object obj)
 {
     Book book = (Book)obj;
     this._currentBook = book;
     eventAggregator.GetEvent<FocusBookChangedEvent>().Publish(book);
 }
示例#7
0
 private void OnRemoveBook()
 {
     if (null != this._currentBook)
     {
         BooksManager.RemoveBook(this._currentBook);
         this._currentBook = null;
         OnViewBookInfo(null);
     }
 }
示例#8
0
 private static void AppendLastBlankBookForAddNew(int rows, List<ShelfRowBooks> bookRows)
 {
     if (bookRows[rows - 1].BookCount == ShelfRowBooks.BOOKS_PER_ROW)
     {
         ShelfRowBooks blankRow = new ShelfRowBooks();
         Book blankBook = new Book();
         blankRow.Books[0] = blankBook;
         blankRow.BookCount = 1;
         bookRows.Add(blankRow);
     }
     else
     {
         ShelfRowBooks lastRow = bookRows[rows - 1];
         lastRow.Books[lastRow.BookCount] = new Book();
         lastRow.BookCount++;
     }
 }
示例#9
0
 public static void RemoveBook(Book book)
 {
     _Books.Remove(book);
 }
示例#10
0
 public static void AddBookLibrary(Book newBook)
 {
     _Books.Add(newBook);
 }
示例#11
0
        static void ParseBooksItems(String items)
        {
            _Books = new List<Book>();
            string[] books = items.Split(';');
            foreach (string book in books)
            {
                if (string.IsNullOrEmpty(book))
                {
                    continue;
                }

                string[] entries = book.Split(',');
                if (entries.Length < 4)
                {
                    continue;
                }
                //Book.BookCategory cat = Book.ParseBookCategory(entries[1]);
                Book b = new Book(entries[0], Book.BookCategory.Other, entries[2], entries[3]);
                b.BookUri = entries[1];
                _Books.Add(b);
            }
        }