移除 Client 和 Server 模块,由 Sharp.Demo 替代
Sharp.Demo 模块已经整合了 Client 和 Server 的所有功能, 并采用了最佳实践(Quick Start API、标准 DI、Result<T> 模式等), 因此 Client 和 Server 模块已不再需要。 变更内容: - 从解决方案中移除 Client 和 Server 项目 - 更新 CLAUDE.md 文档(根目录和 src/Sharp/) - 更新项目结构说明,明确 Sharp.Demo 为综合演示应用 - 更新构建和运行命令,指向 Sharp.Demo - 更新依赖关系说明 Sharp.Demo 优势: - 使用 Quick Start API 简化配置 - 标准依赖注入(移除 Global 容器依赖) - Result<T> 模式演示 - IApplicationState 应用状态管理 - 完整的开发者工具集成(F10/F11/F12) - 交互式模块演示(17+ 功能点) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
1b5d57bd19
commit
8ca0679fca
3 files changed
+22
-46
No files matched your search
@@ -24,7 +24,7 @@ dotnet build Sharp.sln
|
|||||||
### Build specific project
|
### Build specific project
|
||||||
```bash
|
```bash
|
||||||
cd src/Sharp
|
cd src/Sharp
|
||||||
dotnet build Client/Client.csproj # WPF demo application
|
dotnet build Sharp.Demo/Sharp.Demo.csproj # WPF demo application (最佳实践示例)
|
||||||
dotnet build Common/Common.csproj # Core utilities
|
dotnet build Common/Common.csproj # Core utilities
|
||||||
dotnet build Config/Config.csproj # Configuration management
|
dotnet build Config/Config.csproj # Configuration management
|
||||||
```
|
```
|
||||||
@@ -36,10 +36,10 @@ dotnet test Sharp.sln # All tests
|
|||||||
dotnet test ../../test/Common.Test # Specific test project
|
dotnet test ../../test/Common.Test # Specific test project
|
||||||
```
|
```
|
||||||
|
|
||||||
### Run the WPF Client application
|
### Run the Sharp.Demo application
|
||||||
```bash
|
```bash
|
||||||
cd src/Sharp
|
cd src/Sharp
|
||||||
dotnet run --project Client/Client.csproj
|
dotnet run --project Sharp.Demo/Sharp.Demo.csproj
|
||||||
```
|
```
|
||||||
|
|
||||||
### Clean build artifacts
|
### Clean build artifacts
|
||||||
@@ -56,7 +56,9 @@ dotnet clean Sharp.sln
|
|||||||
src/Sharp/ # All source projects
|
src/Sharp/ # All source projects
|
||||||
├── Common/ # Core foundation (Result<T>, Global container, utilities, SystemConfig)
|
├── Common/ # Core foundation (Result<T>, Global container, utilities, SystemConfig)
|
||||||
├── Config/ # Multi-format configuration with hot-reload
|
├── Config/ # Multi-format configuration with hot-reload
|
||||||
├── Wpf/ # WPF UI toolkit (MVVM, dialogs, converters)
|
├── Wpf/ # WPF UI toolkit (MVVM, dialogs, converters) - NO UI library dependency
|
||||||
|
├── Wpf.HandyControl/ # HandyControl UI library integration (optional)
|
||||||
|
├── Wpf.DevTools/ # WPF Developer Tools (DevTools, LogViewer, Performance Monitor)
|
||||||
├── Data/ # EF Core wrapper with repository pattern
|
├── Data/ # EF Core wrapper with repository pattern
|
||||||
├── Log/ # Serilog-based structured logging
|
├── Log/ # Serilog-based structured logging
|
||||||
├── Cache/ # Memory cache (planned)
|
├── Cache/ # Memory cache (planned)
|
||||||
@@ -68,8 +70,7 @@ src/Sharp/ # All source projects
|
|||||||
├── Plc.Siemens/ # Siemens S7 PLC implementation (S7.NET+)
|
├── Plc.Siemens/ # Siemens S7 PLC implementation (S7.NET+)
|
||||||
├── Process/ # Process execution
|
├── Process/ # Process execution
|
||||||
├── Python/ # Python script execution
|
├── Python/ # Python script execution
|
||||||
├── Client/ # WPF demo application
|
└── Sharp.Demo/ # 综合演示应用(最佳实践示例,替代了 Client 和 Server)
|
||||||
└── Server/ # WPF server example
|
|
||||||
|
|
||||||
test/ # MSTest test projects
|
test/ # MSTest test projects
|
||||||
├── Common.Test/
|
├── Common.Test/
|
||||||
|
|||||||
+15
-12
@@ -45,7 +45,7 @@ dotnet build Sharp.sln
|
|||||||
### Build specific project
|
### Build specific project
|
||||||
```bash
|
```bash
|
||||||
cd src/Sharp
|
cd src/Sharp
|
||||||
dotnet build Client/Client.csproj # WPF demo application
|
dotnet build Sharp.Demo/Sharp.Demo.csproj # WPF demo application (最佳实践示例)
|
||||||
dotnet build Common/Common.csproj # Core utilities
|
dotnet build Common/Common.csproj # Core utilities
|
||||||
dotnet build Config/Config.csproj # Configuration management
|
dotnet build Config/Config.csproj # Configuration management
|
||||||
```
|
```
|
||||||
@@ -57,10 +57,10 @@ dotnet test Sharp.sln # All tests
|
|||||||
dotnet test ../../test/Common.Test # Specific test project
|
dotnet test ../../test/Common.Test # Specific test project
|
||||||
```
|
```
|
||||||
|
|
||||||
### Run the WPF Client application
|
### Run the Sharp.Demo application
|
||||||
```bash
|
```bash
|
||||||
cd src/Sharp
|
cd src/Sharp
|
||||||
dotnet run --project Client/Client.csproj
|
dotnet run --project Sharp.Demo/Sharp.Demo.csproj
|
||||||
```
|
```
|
||||||
|
|
||||||
### Clean build artifacts
|
### Clean build artifacts
|
||||||
@@ -79,6 +79,7 @@ src/Sharp/ # All source projects
|
|||||||
├── Config/ # Multi-format configuration with hot-reload
|
├── Config/ # Multi-format configuration with hot-reload
|
||||||
├── Wpf/ # WPF UI toolkit (MVVM, dialogs, converters) - NO UI library dependency
|
├── Wpf/ # WPF UI toolkit (MVVM, dialogs, converters) - NO UI library dependency
|
||||||
├── Wpf.HandyControl/ # HandyControl UI library integration (optional)
|
├── Wpf.HandyControl/ # HandyControl UI library integration (optional)
|
||||||
|
├── Wpf.DevTools/ # WPF Developer Tools (DevTools, LogViewer, Performance Monitor)
|
||||||
├── Data/ # EF Core wrapper with repository pattern
|
├── Data/ # EF Core wrapper with repository pattern
|
||||||
├── Log/ # Serilog-based structured logging
|
├── Log/ # Serilog-based structured logging
|
||||||
├── Cache/ # Memory cache (planned)
|
├── Cache/ # Memory cache (planned)
|
||||||
@@ -90,8 +91,7 @@ src/Sharp/ # All source projects
|
|||||||
├── Plc.Siemens/ # Siemens S7 PLC implementation (S7.NET+)
|
├── Plc.Siemens/ # Siemens S7 PLC implementation (S7.NET+)
|
||||||
├── Process/ # Process execution
|
├── Process/ # Process execution
|
||||||
├── Python/ # Python script execution
|
├── Python/ # Python script execution
|
||||||
├── Client/ # WPF demo application
|
└── Sharp.Demo/ # 综合演示应用(最佳实践示例,替代了 Client 和 Server)
|
||||||
└── Server/ # WPF server example
|
|
||||||
|
|
||||||
test/ # MSTest test projects
|
test/ # MSTest test projects
|
||||||
├── Common.Test/
|
├── Common.Test/
|
||||||
@@ -123,7 +123,7 @@ test/ # MSTest test projects
|
|||||||
- **Primary**: Microsoft.Extensions.DependencyInjection for standard DI
|
- **Primary**: Microsoft.Extensions.DependencyInjection for standard DI
|
||||||
- **Fallback**: Global service locator (Common.Global) for legacy/convenience
|
- **Fallback**: Global service locator (Common.Global) for legacy/convenience
|
||||||
- Services registered in `DependencyInjection` folders within each module
|
- Services registered in `DependencyInjection` folders within each module
|
||||||
- Client app startup (App.xaml.cs) orchestrates all service registration
|
- Sharp.Demo app startup (App.xaml.cs) orchestrates all service registration
|
||||||
|
|
||||||
#### 3. Configuration Management
|
#### 3. Configuration Management
|
||||||
- Multi-source configuration builder supporting JSON/XML/INI/TOML
|
- Multi-source configuration builder supporting JSON/XML/INI/TOML
|
||||||
@@ -170,7 +170,8 @@ test/ # MSTest test projects
|
|||||||
**WPF Layer**:
|
**WPF Layer**:
|
||||||
- Wpf → (no UI library dependency - pure MVVM)
|
- Wpf → (no UI library dependency - pure MVVM)
|
||||||
- Wpf.HandyControl → Wpf, HandyControl 3.5.0 (optional UI library integration)
|
- Wpf.HandyControl → Wpf, HandyControl 3.5.0 (optional UI library integration)
|
||||||
- Client → Wpf, Config, NetClient, NetServer, Log, Plc.Siemens, Ports, HandyControl
|
- Wpf.DevTools → Wpf (Developer Tools: DevTools, LogViewer, Performance Monitor)
|
||||||
|
- Sharp.Demo → Wpf, Wpf.HandyControl, Wpf.DevTools, Config, NetClient, NetServer, Log, Data, Plc.Siemens, Ports, Process, Python
|
||||||
|
|
||||||
**Industrial IoT**:
|
**Industrial IoT**:
|
||||||
- Ports → (serial port communication)
|
- Ports → (serial port communication)
|
||||||
@@ -250,19 +251,21 @@ var config = ConfigBuilder.CreateDefault().Configuration;
|
|||||||
4. Register with DI: `services.AddSingleton(cfg)` and `services.AddSingleton(cfg.Configuration)`
|
4. Register with DI: `services.AddSingleton(cfg)` and `services.AddSingleton(cfg.Configuration)`
|
||||||
5. Use hot-reload callbacks: `cfg.OnReload(() => { /* refresh */ })`
|
5. Use hot-reload callbacks: `cfg.OnReload(() => { /* refresh */ })`
|
||||||
|
|
||||||
### WPF Client startup flow (Modern Quick Start)
|
### WPF Sharp.Demo startup flow (Modern Quick Start)
|
||||||
```csharp
|
```csharp
|
||||||
protected override void OnStartup(StartupEventArgs e) {
|
protected override void OnStartup(StartupEventArgs e) {
|
||||||
var services = new ServiceCollection();
|
var services = new ServiceCollection();
|
||||||
var config = ConfigBuilder.CreateDefault().Configuration;
|
var config = ConfigBuilderExtensions.CreateDefault().Configuration;
|
||||||
|
|
||||||
services.AddSharpEssentials(config);
|
services.AddSharpEssentials(config);
|
||||||
services.AddSharpWpf();
|
services.AddSharpWpf();
|
||||||
services.AddViewModel<MainViewModel>();
|
services.AddSharpHandyControl();
|
||||||
services.AddTransient<MainWindow>();
|
services.AddSharpDevTools();
|
||||||
|
services.AddViewModel<LauncherViewModel>();
|
||||||
|
services.AddTransient<LauncherWindow>();
|
||||||
|
|
||||||
var provider = services.BuildServiceProvider();
|
var provider = services.BuildServiceProvider();
|
||||||
provider.GetRequiredService<MainWindow>().Show();
|
provider.GetRequiredService<LauncherWindow>().Show();
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
|||||||
# Visual Studio Version 17
|
# Visual Studio Version 17
|
||||||
VisualStudioVersion = 17.13.35931.197
|
VisualStudioVersion = 17.13.35931.197
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Client", "Client\Client.csproj", "{5979868C-C09D-4B3F-8909-C661F94EFFBE}"
|
|
||||||
EndProject
|
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Common", "Common\Common.csproj", "{EF054B5F-5D65-4917-B2D7-A85FA2719128}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Common", "Common\Common.csproj", "{EF054B5F-5D65-4917-B2D7-A85FA2719128}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Config", "Config\Config.csproj", "{37FBE4C9-1658-4953-8D12-71068EE28804}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Config", "Config\Config.csproj", "{37FBE4C9-1658-4953-8D12-71068EE28804}"
|
||||||
@@ -29,8 +27,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Log.Test", "..\..\test\Log.
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NetServer.Test", "..\..\test\NetServer.Test\NetServer.Test.csproj", "{020997C0-FB5F-4222-8620-818840EF4447}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NetServer.Test", "..\..\test\NetServer.Test\NetServer.Test.csproj", "{020997C0-FB5F-4222-8620-818840EF4447}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Server", "Server\Server.csproj", "{C2505AD1-D775-4881-A56F-42BDB7CDE58D}"
|
|
||||||
EndProject
|
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Data", "Data\Data.csproj", "{D4FAD87A-D436-4F66-8A7F-B57DD130E966}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Data", "Data\Data.csproj", "{D4FAD87A-D436-4F66-8A7F-B57DD130E966}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Data.Test", "..\..\test\Data.Test\Data.Test.csproj", "{8EEC8BF4-CF9A-473D-B7A0-005E151C645D}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Data.Test", "..\..\test\Data.Test\Data.Test.csproj", "{8EEC8BF4-CF9A-473D-B7A0-005E151C645D}"
|
||||||
@@ -63,18 +59,6 @@ Global
|
|||||||
Release|x86 = Release|x86
|
Release|x86 = Release|x86
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{5979868C-C09D-4B3F-8909-C661F94EFFBE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{5979868C-C09D-4B3F-8909-C661F94EFFBE}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{5979868C-C09D-4B3F-8909-C661F94EFFBE}.Debug|x64.ActiveCfg = Debug|Any CPU
|
|
||||||
{5979868C-C09D-4B3F-8909-C661F94EFFBE}.Debug|x64.Build.0 = Debug|Any CPU
|
|
||||||
{5979868C-C09D-4B3F-8909-C661F94EFFBE}.Debug|x86.ActiveCfg = Debug|Any CPU
|
|
||||||
{5979868C-C09D-4B3F-8909-C661F94EFFBE}.Debug|x86.Build.0 = Debug|Any CPU
|
|
||||||
{5979868C-C09D-4B3F-8909-C661F94EFFBE}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{5979868C-C09D-4B3F-8909-C661F94EFFBE}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{5979868C-C09D-4B3F-8909-C661F94EFFBE}.Release|x64.ActiveCfg = Release|Any CPU
|
|
||||||
{5979868C-C09D-4B3F-8909-C661F94EFFBE}.Release|x64.Build.0 = Release|Any CPU
|
|
||||||
{5979868C-C09D-4B3F-8909-C661F94EFFBE}.Release|x86.ActiveCfg = Release|Any CPU
|
|
||||||
{5979868C-C09D-4B3F-8909-C661F94EFFBE}.Release|x86.Build.0 = Release|Any CPU
|
|
||||||
{EF054B5F-5D65-4917-B2D7-A85FA2719128}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{EF054B5F-5D65-4917-B2D7-A85FA2719128}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{EF054B5F-5D65-4917-B2D7-A85FA2719128}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{EF054B5F-5D65-4917-B2D7-A85FA2719128}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{EF054B5F-5D65-4917-B2D7-A85FA2719128}.Debug|x64.ActiveCfg = Debug|Any CPU
|
{EF054B5F-5D65-4917-B2D7-A85FA2719128}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||||
@@ -219,18 +203,6 @@ Global
|
|||||||
{020997C0-FB5F-4222-8620-818840EF4447}.Release|x64.Build.0 = Release|Any CPU
|
{020997C0-FB5F-4222-8620-818840EF4447}.Release|x64.Build.0 = Release|Any CPU
|
||||||
{020997C0-FB5F-4222-8620-818840EF4447}.Release|x86.ActiveCfg = Release|Any CPU
|
{020997C0-FB5F-4222-8620-818840EF4447}.Release|x86.ActiveCfg = Release|Any CPU
|
||||||
{020997C0-FB5F-4222-8620-818840EF4447}.Release|x86.Build.0 = Release|Any CPU
|
{020997C0-FB5F-4222-8620-818840EF4447}.Release|x86.Build.0 = Release|Any CPU
|
||||||
{C2505AD1-D775-4881-A56F-42BDB7CDE58D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{C2505AD1-D775-4881-A56F-42BDB7CDE58D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{C2505AD1-D775-4881-A56F-42BDB7CDE58D}.Debug|x64.ActiveCfg = Debug|Any CPU
|
|
||||||
{C2505AD1-D775-4881-A56F-42BDB7CDE58D}.Debug|x64.Build.0 = Debug|Any CPU
|
|
||||||
{C2505AD1-D775-4881-A56F-42BDB7CDE58D}.Debug|x86.ActiveCfg = Debug|Any CPU
|
|
||||||
{C2505AD1-D775-4881-A56F-42BDB7CDE58D}.Debug|x86.Build.0 = Debug|Any CPU
|
|
||||||
{C2505AD1-D775-4881-A56F-42BDB7CDE58D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{C2505AD1-D775-4881-A56F-42BDB7CDE58D}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{C2505AD1-D775-4881-A56F-42BDB7CDE58D}.Release|x64.ActiveCfg = Release|Any CPU
|
|
||||||
{C2505AD1-D775-4881-A56F-42BDB7CDE58D}.Release|x64.Build.0 = Release|Any CPU
|
|
||||||
{C2505AD1-D775-4881-A56F-42BDB7CDE58D}.Release|x86.ActiveCfg = Release|Any CPU
|
|
||||||
{C2505AD1-D775-4881-A56F-42BDB7CDE58D}.Release|x86.Build.0 = Release|Any CPU
|
|
||||||
{D4FAD87A-D436-4F66-8A7F-B57DD130E966}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{D4FAD87A-D436-4F66-8A7F-B57DD130E966}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{D4FAD87A-D436-4F66-8A7F-B57DD130E966}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{D4FAD87A-D436-4F66-8A7F-B57DD130E966}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{D4FAD87A-D436-4F66-8A7F-B57DD130E966}.Debug|x64.ActiveCfg = Debug|Any CPU
|
{D4FAD87A-D436-4F66-8A7F-B57DD130E966}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||||
|
|||||||
Reference in new issue
Block a user