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# (.NET8.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# (.NET8.0)
The following packages are used:
- CommunityToolkit.Mvvm (8.3.2)
- CommunityToolkit.WinUI.Controls.SettingsControls (8.1.240916)
- CommunityToolkit.WinUI.Controls.Primitives (8.1.240916)
- CommunityToolkit.WinUI.UI.Controls.DataGrid (7.1.2)
- Microsoft.Extensions.Configuration (9.0.0)
- Microsoft.Extensions.Hosting (9.0.0)
- Microsoft.WindowsAppSDK (1.6.241114003)
- Microsoft.Xaml.Behaviors.WinUI.Managed (2.0.9)
- WinUIEx (2.5.0)
- Dapper (2.1.35")
- Dapper.Contrib (2.0.78)
- Microsoft.Data.Sqlite (9.0.0)
- Newtonsoft.Json (13.0.3)
- Microsoft.Graphics.Win2D (1.3.0)
- Microsoft.NET.Test.Sdk (17.12.0)
- NUnit (4.2.2)
- NUnit3TestAdapter (4.6.0)
- NUnit.Analyzers (4.4.0)
- coverlet.collector (6.0.2)
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.
![Initial Empty Catalog (BookCatalog)](/Adam-Gladstone/BookCatalog/raw/master/Images/EmptyCatalog.png)
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.
![Ungrouped Search (BookCatalog)](/Adam-Gladstone/BookCatalog/raw/master/Images/UngroupedSearch.png)
The default is to list the books by title (alphabetically). The category button allows grouping by Category.
![Grouped Search (BookCatalog)](/Adam-Gladstone/BookCatalog/raw/master/Images/GroupedSearch.png)
![Filter (BookCatalog)](/Adam-Gladstone/BookCatalog/raw/master/Images/FilterTitle.png)
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