Table of Contents
I have around 500+ e-books (mostly pdf
's but also some epub
's). I wanted to be able to easily search for a specific title or author, as I don't always remember either exactly (e.g. "erm, I think it was about 'compilers'; maybe the author was 'Holub' or 'Aho' ..."). I have tried a number of approaches to this: Windows search, PowerShell script, and so on. None of these were really satisfactory for one reason or another. Eventually, I settled for writing a simple cataloguing application. This is it (or at least an initial version of it).
BookCatalog is a Windows desktop application that allows you to list and organise your (electronic) book collection. It is simple to add titles to the collection. Just point to a directory and add files. The application provides simple facilities to search, sort, filter and group books. Once you have found the book(s) you were looking for, you can double-click to open the file in the associated application.
BookCatalog is written in C# (.NET6.0) and uses WinUI and XAML for the user interface.
BookCatalog demonstrates:
- C#/WinUI and XAML for the UI
- Local file-based database using SQLite
- Community Toolkit features, specifically
- settings page (with support for light/dark themes)
- page navigation
- dependency injection
- flyout menus
- a local sqlite database
- MVVM architecture
- Custom exception dialog
- Separate projects for the core (reusable functionality), testing, and user interface.
- Unit testing using NUnit
- Visual Studio 2022
- C# (.NET6.0)
The following packages are used:
- CommunityToolkitMvvm (8.2.2)
- CommunityToolkit.WinUI.UI.Controls (7.1.2)
- CommunityToolkit.WinUI.UI.Controls.DataGrid (7.1.2)
- Microsoft.Extensions.Configuration (8.0.0)
- Microsoft.Extensions.Hosting (8.0.0)
- Microsoft.WindowsAppSDK (1.4.23115000)
- Microsoft.Xaml.Behaviours.WinUI.Managed (2.0.9)
- WinUIEx (2.3.3)
The project can be downloaded from the GitHub repository in the usual way.
The solution consists of three projects:
- BookCatalog: this contains the main application code.
- BookCatalog.Core: this contains the core reusable code. In this case it only consists of the book model class and the database service.
- BookCatalog.Tests.NUnit: this consists of unit tests for the core database functionality.
Build and start the application for the first time. You will be presented with an empty Catalog screen.
Locate and press the 'Add' button. The Open File Dialog is displayed. Navigate to the directory where the books are located. It is useful if the books are organised by a category as this can be used for grouping. Otherwise the titles are presented in a simple list. Select all the files to be added and press 'OK'. Wait a few seconds while the titles are being added to the database, then you are presented with a list.
The default is to list the books by title (alphabetically). The category button allows grouping by Category.
The search bar can be used to filter the titles.Future directions:
See the open issues for a full list of proposed features (and known issues).
Distributed under the GPL-3.0 License. See LICENSE.md
for more information.
Adam Gladstone - (https://www.linkedin.com/in/adam-gladstone-b6458b156/)
Project Link: https://github.com/Adam-Gladstone/BookCatalog
Helpful resources