Oakrey.Applications.Help
3.0.3
dotnet add package Oakrey.Applications.Help --version 3.0.3
NuGet\Install-Package Oakrey.Applications.Help -Version 3.0.3
<PackageReference Include="Oakrey.Applications.Help" Version="3.0.3" />
<PackageVersion Include="Oakrey.Applications.Help" Version="3.0.3" />
<PackageReference Include="Oakrey.Applications.Help" />
paket add Oakrey.Applications.Help --version 3.0.3
#r "nuget: Oakrey.Applications.Help, 3.0.3"
#:package Oakrey.Applications.Help@3.0.3
#addin nuget:?package=Oakrey.Applications.Help&version=3.0.3
#tool nuget:?package=Oakrey.Applications.Help&version=3.0.3
Oakrey.Applications.Help
A WPF/.NET 10 library that provides a structured, interactive help system for desktop applications. It scans a directory of Markdown files, builds a hierarchical navigation tree, and exposes a ready-to-bind HelpViewModel with forward/back navigation history.
Main features
- Recursive directory scan that builds a tree of
FolderandMarkdownFileitems (HelpLoader) HelpServiceresolves the help root fromIApplicationInfo.HelpPathand exposes the file treeHelpViewModelimplementsINotifyPropertyChangedwithNext/Prevcommands and a full browsing history (ObservableCollection<Uri>)BindableTreeView- a WPFTreeViewsubclass that exposesSelectedItemandPreviewSelectedItemas two-way bindable dependency properties- DI registration via a single
IServiceCollectionextension method - Integrated
Oakrey.Logtracing on service start and dispose
Architecture
classDiagram
IHelpService <|.. HelpService
HelpService --> HelpLoader : uses
HelpLoader --> FileSystemItem : produces
FileSystemItem <|-- Folder
FileSystemItem <|-- MarkdownFile
HelpViewModel --> IHelpService : consumes
HelpViewModel --> HelpLoader : fallback (default ctor)
BindableTreeView --> HelpViewModel : binds SelectedItem
| Class / Type | Role |
|---|---|
IHelpService |
Abstraction over the file tree; inject this in application code |
HelpService |
Reads IApplicationInfo.HelpPath, builds the tree, implements IDisposable |
HelpLoader |
Static recursive scanner; skips attachments subdirectories |
FileSystemItem |
Abstract base for tree nodes |
Folder |
Represents a subdirectory; contains child FileSystemItem nodes |
MarkdownFile |
Represents a .md file; exposes Path for URI navigation |
HelpViewModel |
INPC ViewModel; tracks current file, MdSource URI, and history stack |
BindableTreeView |
WPF TreeView with bindable SelectedItem and PreviewSelectedItem |
HelpConfigurationExtension |
Registers HelpViewModel and IHelpService with the DI container |
Requirements
- .NET 10 (Windows)
- WPF host application
Oakrey.ViewModels>= 2.1.0Oakrey.Applications(providesIApplicationInfo)
Installation
NuGet Package Manager
- Open your project in Visual Studio.
- Navigate to Tools > NuGet Package Manager > Manage NuGet Packages for Solution.
- Search for
Oakrey.Applications.Helpand click Install.
.NET CLI
dotnet add package Oakrey.Applications.Help
Package Manager Console
Install-Package Oakrey.Applications.Help
Configuration
Register the help services during application startup:
services.ConfigureHelpServices();
This registers:
IHelpServiceasHelpService(transient)HelpViewModel(transient)
HelpService expects IApplicationInfo to be registered separately. It reads IApplicationInfo.HelpPath as the root directory for Markdown files.
Example usage
ViewModel binding
// Inject or resolve HelpViewModel
public class ShellViewModel
{
public HelpViewModel Help { get; }
public ShellViewModel(HelpViewModel help)
{
Help = help;
}
}
XAML
<help:BindableTreeView
ItemsSource="{Binding Help.Files}"
SelectedItem="{Binding Help.File}" />
<WebBrowser Source="{Binding Help.MdSource}" />
<Button Command="{Binding Help.Prev}" Content="Back" />
<Button Command="{Binding Help.Next}" Content="Forward" />
Help directory layout
The help root directory should contain .md files and optional subdirectories. Subdirectories named attachments are automatically excluded from the tree.
Assets/
Help.md <- default landing file (matched by name "Help")
GettingStarted.md
Advanced/
Configuration.md
attachments/ <- excluded from tree
diagram.png
Development notes
HelpViewModelhas two constructors: a default constructor that reads from{BaseDirectory}/Assets/, and a DI constructor that acceptsIHelpService. The DI constructor is used when the service is registered viaConfigureHelpServices().- Navigation history is maintained as an
ObservableCollection<Uri>.NextandPrevcommands are enabled/disabled automatically viaRelayCommandpredicates. BindableTreeViewworks around the WPFTreeViewlimitation thatSelectedItemis read-only by exposing a new bindableSelectedItemdependency property.- All
HelpServicelifecycle events are traced throughOakrey.Log.
Project information
- Author: Oakrey
- License: MIT
- Repository: ApplicationServices
- Project URL: oakrey.cz
Contributions are welcome! Feel free to open issues or submit pull requests to improve the package.
License
This project is licensed under the MIT License. See the LICENSE file for details.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0-windows7.0 is compatible. |
-
net10.0-windows7.0
- Oakrey.Applications.Base (>= 4.0.3)
- Oakrey.ViewModels (>= 2.1.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.