Baboon 2.0.0

dotnet add package Baboon --version 2.0.0                
NuGet\Install-Package Baboon -Version 2.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Baboon" Version="2.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Baboon --version 2.0.0                
#r "nuget: Baboon, 2.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Baboon as a Cake Addin
#addin nuget:?package=Baboon&version=2.0.0

// Install Baboon as a Cake Tool
#tool nuget:?package=Baboon&version=2.0.0                

Baboon项目总结

项目简介

Baboon是一个轻量级WPF插件化开发的基础库,内置了模块化加载、模块化日志记录、模块化本地存储、模块化IOC注册,以及开发Mvvm必要的Command和EventTrigger。

安装方法

通过nuget安装Baboon

Install-Package Baboon

使用说明

基础配置

安装完成后,需要在App.xaml.cs中修改基类继承,同时在App.xaml.cs中实现抽象类成员,包括注册容器和创建主窗口。

新建模块

  • 创建项目与类:新建一个项目,命名为SayHello.Module,添加对Baboon的引用,新建SayHelloModule类,继承自AppModuleBase或实现IAppModule接口,并实现基本成员。
  • 模块描述ModuleDescription可以直接赋值,也可以通过xml文件定义。

模块注册

App中重写ConfigureModuleCatalog方法来注册模块,注册方式有三种:

  • 实例注册:直接将模块实例注册到主程序,会立刻加载模块,且主程序需要引用模块。
  • 类型注册:将模块类型注册到主程序,会立刻加载模块,且主程序需要引用模块。
  • 构建器注册:只注册模块信息,需要时自动加载模块,主程序不需要引用模块。

模块加载与使用

  • 加载:模块加载是自动的,包括构建器注册的模块,会在需要时加载。
  • 使用:从容器中获得IModuleCatalog,使用Contains(id)方法判断模块是否已注册,通过TryGetAppModuleInfo获取模块信息,根据appModuleInfo.Loaded属性判断模块是否已加载到主程序,使用appModuleInfo.GetApp()获取指定模块。

模块管理器

使用IModuleManagerService服务可实现对模块的快速管理,包括安装、更新、卸载等。IModuleCatalog会对存放在Modules文件夹下的所有模块进行注册,但每个模块必须包含名为Description.xml的文件。

模块日志

每个模块可以拥有单独的日志记录器,通过IAppModule.Logger获得。

模块本地数据库

Baboon集成了LiteDB数据库,并封装了KV键值存储,使用IConfigurationStoreService即可。

Mvvm框架

  • CommandExecuteCommand类。
  • ViewModelObservableObjectViewModelBase类。
  • 容器注册View并绑定:在App.xaml.csRegisterTypes方法中使用container.RegisterSingletonView<MainWindow, MainViewModel>();进行注册。
  • 绑定事件触发器:使用EventAction实现。

参与贡献

  1. Fork本仓库
  2. 新建Feat_xxx分支
  3. 提交代码
  4. 新建Pull Request
Product Compatible and additional computed target framework versions.
.NET net6.0-windows7.0 is compatible.  net7.0-windows was computed.  net8.0-windows was computed.  net9.0-windows was computed. 
.NET Framework net462 is compatible.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.0.0 34 2/14/2025
1.2.0 116 10/21/2024
1.1.3 92 8/24/2024
1.1.2 104 3/8/2024
1.1.1 96 3/1/2024
1.1.0 212 11/13/2023
1.0.0 103 9/26/2023
1.0.0-beta 81 9/22/2023