# LindaSimple.Wpf
**Repository Path**: Klyo/linda-simple.wpf
## Basic Information
- **Project Name**: LindaSimple.Wpf
- **Description**: LindaSimple.Wpf 是一款面向工业自动化场景的上位机控制系统,采用 DDD(领域驱动设计) 分层架构,集成设备通讯、数据采集、配方管理、实时监控等核心能力。界面基于 Material Design 风格,功能模块高度可扩展,可用于快速搭建半导体、CMP 等工业设备的运行控制与监控软件。
- **Primary Language**: C#
- **License**: Apache-2.0
- **Default Branch**: develop
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 37
- **Created**: 2026-08-16
- **Last Updated**: 2026-08-16
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# LindaSimple.Wpf
**一款基于 WPF 与 DDD 领域驱动设计的工业上位机(HMI)快速开发框架**
[](https://dotnet.microsoft.com/)
[](https://learn.microsoft.com/dotnet/desktop/wpf/)
[](./LICENSE)
[](https://learn.microsoft.com/windows/)
## 📖 项目简介
LindaSimple.Wpf 是一款面向工业自动化场景的上位机控制系统,采用 **DDD(领域驱动设计)** 分层架构,集成设备通讯、数据采集、配方管理、实时监控等核心能力。界面基于 Material Design 风格,功能模块高度可扩展,可用于快速搭建半导体、CMP 等工业设备的运行控制与监控软件。
## ✨ 核心特性
- **DDD 分层架构**:严格的领域驱动分层,职责清晰、易于测试与演进
- **MVVM 双向绑定**:基于 `CommunityToolkit.Mvvm` 的 Source Generator 模式,样板代码极少
- **模块化解耦**:通过 `MediatR` 实现命令 / 事件驱动的 CQRS 风格协作
- **工业通讯抽象**:`ReaderFactory` + `ReaderStrategy` 工厂策略模式,集成 `HslCommunication` 支持主流 PLC / 仪表协议
- **Material Design UI**:`MaterialDesignThemes` 现代化界面,内置多皮肤切换
- **轻量持久化**:`SqlSugarCore` + `SQLite`,开箱即用,可平滑切换至其他数据库
- **结构化日志**:`Serilog` 多 Sink 输出(控制台 / 文件),配置驱动
- **插件化扩展**:独立的 `DillonMvvm.Plugins` 可独立打包(`GeneratePackageOnBuild`)
- **数据导入导出**:`MiniExcel` 高性能 Excel 处理
- **远程文件交互**:`Renci.SshNet.Async` 支持 SFTP / SSH 远程操作





## 🛠️ 技术栈
| 分类 | 技术 / 组件 | 版本 |
| --- | --- | --- |
| 运行时 | .NET (WPF) | 8.0 (net8.0-windows) |
| MVVM | CommunityToolkit.Mvvm | 8.4.0 |
| UI 主题 | MaterialDesignThemes | 5.2.1 |
| 中介者 / CQRS | MediatR | 13.0.0 |
| ORM | SqlSugarCore | 5.1.4.198 |
| 数据库 | Microsoft.Data.Sqlite | 9.0.8 |
| 对象映射 | Mapster / Mapster.DependencyInjection | 7.4.0 |
| 日志 | Serilog (Console / File / Hosting) | 4.3.0 |
| Excel | MiniExcel | 1.41.3 |
| 工业通讯 | HslCommunication | 12.3.3 |
| 远程交互 | Renci.SshNet.Async | 1.4.0 |
| 图表 | LiveCharts.Wpf | 0.9.7 |
| 主机 / DI | Microsoft.Extensions.Hosting | 9.0.7 |
## 🏗️ 软件架构
项目遵循 DDD 经典分层,由表示层、应用层、领域层、领域核心、基础设施层、控件库与插件层组成。
```
┌──────────────────────────────────────────────────────────┐
│ LindaSimple.GenericWpf.App 表示层 / 启动宿主 │
│ Views · ViewModels · Themes · Resources · Common │
└───────┬──────────────────┬───────────────────┬──────────┘
│ │ │
┌───────▼──────────┐ ┌─────▼──────┐ ┌────────▼─────────┐
│ Application │ │ Controls │ │ DillonMvvm. │
│ 应用层 │ │ 控件库 │ │ Plugins 插件层 │
│ Services/Dtos/ │ │ │ │ │
│ EventHandlers │ │ │ │ │
└───────┬──────────┘ └────────────┘ └──────────────────┘
│
┌───────▼──────────┐
│ Domain │ 领域层:Entities / EventBus
│ Domain.Core │ 领域核心:EntityBases / Repository 抽象 / Communication 抽象
└───────┬──────────┘
│
┌───────▼──────────┐
│ Infrastructure │ 基础设施层:Repositories 实现 / Communication(ReaderFactory/Strategy)
│ │ Configuration / Utils
└──────────────────┘
```
**项目依赖关系**
| 项目 | 职责 | 依赖 |
| --- | --- | --- |
| `LindaSimple.GenericWpf.App` | 启动入口、视图与视图模型 | Application、Controls、Infrastructure、Plugins |
| `LindaSimple.GenericWpf.Application` | 应用服务、事件处理、DTO | Domain |
| `LindaSimple.Wpf.Domain` | 领域实体、领域事件 | Domain.Core、Infrastructure |
| `LindaSimple.Wpf.Domain.Core` | 领域抽象基类与接口 | — |
| `LindaSimple.Wpf.Infrastructure` | 仓储实现、设备通讯、配置 | Domain.Core |
| `LindaSimple.GenericWpf.Controls` | 通用 WPF 用户控件库 | — |
| `DillonMvvm.Plugins` | 可独立打包的插件包 | — |
## 📂 目录结构
```
Linda-Simple/
├── LindaSimple.GenericWpf.App/ # 启动项目 (WinExe)
│ ├── Common/ # 通用:特性、组件、转换器、事件总线、服务
│ ├── Models/
│ ├── Resources/ # 字体、图片、语言、样式
│ ├── Themes/ # 主题资源
│ ├── ViewModels/ # Dialog / Sub / Work 视图模型
│ └── Views/ # 主窗口及各功能视图
├── LindaSimple.GenericWpf.Application/ # 应用层
│ ├── Dtos/
│ ├── EventHandlers/
│ └── Services/
├── LindaSimple.Wpf.Domain/ # 领域层
│ ├── Entities/
│ ├── EventBus/
│ └── Extension/
├── LindaSimple.Wpf.Domain.Core/ # 领域核心
│ ├── Communication/ # 通讯抽象
│ ├── EntityBases/
│ ├── EventBus/
│ └── Repository/ # 仓储抽象
├── LindaSimple.Wpf.Infrastructure/ # 基础设施层
│ ├── Common/ # Extension / Utils
│ ├── Communication/ # ReaderFactory / ReaderStrategy
│ ├── Configuration/ # appsettings / Database / Serilog
│ ├── Repositories/ # 仓储实现
│ └── sqlsugar/
├── LindaSimple.GenericWpf.Controls/ # 通用控件库
├── DillonMvvm.Plugins/ # 插件层(可打包为 NuGet)
│ ├── Attributes/
│ ├── Extensions/
│ ├── IServices/
│ ├── Models/
│ └── Services/
├── DLLs/ # 第三方依赖
└── LindaSimple.Wpf.sln
```
## 🚀 快速开始
### 环境要求
- **.NET 8.0 SDK** 及以上
- **Visual Studio 2022 (17.8+)** 或 **VS Code**(安装 C# 与 .NET 桌面开发工作负载)
- **Windows 10 / 11**(WPF 依赖 Windows 桌面运行时)
### 获取与运行
```bash
# 1. 克隆仓库
git clone https://gitee.com/wang-teng111109876/linda-simple.wpf.git
cd linda-simple.wpf
# 2. 还原依赖
dotnet restore
# 3. 编译解决方案
dotnet build
# 4. 运行启动项目
dotnet run --project LindaSimple.GenericWpf.App/LindaSimple.GenericWpf.App.csproj
```
> 也可直接使用 Visual Studio 2022 打开 `LindaSimple.Wpf.sln`,将 `LindaSimple.GenericWpf.App` 设为启动项目后按 `F5` 运行。
## ⚙️ 配置说明
运行时配置文件位于 `LindaSimple.Wpf.Infrastructure/Configuration/`,构建时会复制到输出目录:
| 文件 | 用途 |
| --- | --- |
| `appsettings.json` | 应用级通用配置 |
| `Database.json` | 数据库连接与 SqlSugar 配置 |
| `Serilog.json` | Serilog 日志级别与输出 Sink 配置 |
通讯相关参数(设备地址、协议类型等)通过 `ReaderFactory` + `ReaderStrategy` 注入,可按设备类型扩展策略实现。
## 🧩 主要功能模块
| 模块 | 视图 | 说明 |
| --- | --- | --- |
| 登录鉴权 | `LoginView` | 用户登录与权限入口 |
| 主框架 | `MainWindowView` | 导航与页面承载 |
| 首页看板 | `HomeView` | 关键指标与状态概览 |
| 工作台 | `WorkView` | 日常作业主界面 |
| 实时监控 | `MonitorView` | 设备状态与 LiveCharts 实时曲线 |
| 配方管理 | `FormulationView` | 工艺配方维护与下发 |
| 业务配置 | `BusinessConfigureView` | 业务参数配置 |
| 系统设置 | `SettingsView` / `SystemSettingView` | 系统级参数 |
| 主题皮肤 | `SkinView` | 界面主题切换 |
| 关于 | `AboutView` | 版本与作者信息 |
## 🤝 参与贡献
1. Fork 本仓库
2. 新建特性分支,如 `feat/xxx`
3. 提交代码(遵循现有代码风格与提交规范)
4. 新建 Pull Request 并描述变更内容
## 📄 开源许可
本项目基于 [Apache License 2.0](./LICENSE) 开源,转载 / 引用请注明出处。
## 🙏 致谢
本项目站在以下优秀开源项目的肩膀上,在此致以诚挚感谢:
- [CommunityToolkit.Mvvm](https://github.com/CommunityToolkit/Mvvm)
- [MaterialDesignThemes](https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit)
- [MediatR](https://github.com/jbogard/MediatR)
- [SqlSugar](https://github.com/DotNetNext/SqlSugar)
- [Mapster](https://github.com/MapsterMapper/Mapster)
- [Serilog](https://github.com/serilog/serilog)
- [MiniExcel](https://github.com/mini-software/MiniExcel)
- [HslCommunication](https://github.com/dathlin/HslCommunication)
- [LiveCharts](https://github.com/Live-Charts/Live-Charts)