diff --git a/XplorePlane/App.config b/XplorePlane/App.config index e686b60..079fa00 100644 --- a/XplorePlane/App.config +++ b/XplorePlane/App.config @@ -24,6 +24,13 @@ + + + + + + + diff --git a/XplorePlane/App.xaml.cs b/XplorePlane/App.xaml.cs index 3695e41..b450e6b 100644 --- a/XplorePlane/App.xaml.cs +++ b/XplorePlane/App.xaml.cs @@ -14,8 +14,20 @@ using Prism.DryIoc; using Prism.Modularity; using Serilog; using XP.Common.Module; +using XP.Common.Configs; +using XP.Common.Database.Interfaces; +using XP.Common.Database.Implementations; +using XP.Common.Localization.Configs; +using XP.Common.Localization.Implementations; +using XP.Common.Localization.Interfaces; +using XP.Common.Localization.Extensions; +using XP.Common.Dump.Configs; +using XP.Common.Dump.Implementations; +using XP.Common.Dump.Interfaces; using XP.Hardware.RaySource.Module; using XP.Hardware.RaySource.Services; +using XP.Hardware.RaySource.Abstractions; +using XP.Hardware.RaySource.Factories; namespace XplorePlane { @@ -214,18 +226,57 @@ namespace XplorePlane containerRegistry.Register(); containerRegistry.Register(); + // 注册硬件库的 ViewModel(供 ViewModelLocator 自动装配) + containerRegistry.Register(); + + // 注册 SQLite 配置和数据库上下文(FilamentLifetimeService 依赖) + var sqliteConfig = XP.Common.Helpers.ConfigLoader.LoadSqliteConfig(); + containerRegistry.RegisterInstance(sqliteConfig); + containerRegistry.RegisterSingleton(); + + // 手动注册射线源模块的所有服务(确保 DryIoc 容器中可用,避免模块加载顺序问题) + var raySourceConfig = XP.Hardware.RaySource.Config.ConfigLoader.LoadConfig(); + containerRegistry.RegisterInstance(raySourceConfig); + containerRegistry.RegisterSingleton(); + containerRegistry.RegisterSingleton(); + containerRegistry.RegisterSingleton(); + + // 手动注册通用模块的服务(本地化、Dump) + containerRegistry.RegisterSingleton(); + containerRegistry.RegisterSingleton(); + containerRegistry.RegisterSingleton(() => XP.Common.Helpers.ConfigLoader.LoadDumpConfig()); + containerRegistry.RegisterSingleton(); + Log.Information("依赖注入容器配置完成"); } protected override void ConfigureModuleCatalog(IModuleCatalog moduleCatalog) { - // 通用模块(注册 ILocalizationService、ILocalizationConfig)— 必须在 RaySourceModule 之前 - moduleCatalog.AddModule(); - - // 射线源模块(自动注册 IRaySourceService、IRaySourceFactory、RaySourceConfig) - moduleCatalog.AddModule(); - + // 所有模块服务已在 RegisterTypes 中手动注册 + // CommonModule: ILocalizationService, IDumpService + // RaySourceModule: IRaySourceService, IRaySourceFactory, IFilamentLifetimeService base.ConfigureModuleCatalog(moduleCatalog); } + + protected override void InitializeModules() + { + base.InitializeModules(); + + // 手动初始化本地化扩展(原由 CommonModule.OnInitialized 完成) + // 必须在 CreateShell 之前执行,XAML 中的 {loc:Localization} 标记扩展依赖它 + var locService = Container.Resolve(); + LocalizationExtension.Initialize(locService); + + // 启动 Dump 服务 + try + { + var dumpService = Container.Resolve(); + dumpService.Start(); + } + catch (System.Exception ex) + { + Log.Warning(ex, "Dump 服务启动失败,跳过"); + } + } } } diff --git a/XplorePlane/Libs/Hardware/XP.Common.dll b/XplorePlane/Libs/Hardware/XP.Common.dll index 82750df..f542a8b 100644 Binary files a/XplorePlane/Libs/Hardware/XP.Common.dll and b/XplorePlane/Libs/Hardware/XP.Common.dll differ diff --git a/XplorePlane/Libs/Hardware/XP.Common.pdb b/XplorePlane/Libs/Hardware/XP.Common.pdb index abb871e..50c04b0 100644 Binary files a/XplorePlane/Libs/Hardware/XP.Common.pdb and b/XplorePlane/Libs/Hardware/XP.Common.pdb differ diff --git a/XplorePlane/Libs/Hardware/XP.Hardware.RaySource.dll b/XplorePlane/Libs/Hardware/XP.Hardware.RaySource.dll index a80858b..316e58f 100644 Binary files a/XplorePlane/Libs/Hardware/XP.Hardware.RaySource.dll and b/XplorePlane/Libs/Hardware/XP.Hardware.RaySource.dll differ diff --git a/XplorePlane/Libs/Hardware/XP.Hardware.RaySource.pdb b/XplorePlane/Libs/Hardware/XP.Hardware.RaySource.pdb index 05a96ff..78c588d 100644 Binary files a/XplorePlane/Libs/Hardware/XP.Hardware.RaySource.pdb and b/XplorePlane/Libs/Hardware/XP.Hardware.RaySource.pdb differ diff --git a/XplorePlane/Libs/Hardware/en-US/XP.Common.resources.dll b/XplorePlane/Libs/Hardware/en-US/XP.Common.resources.dll index e294ebe..355f436 100644 Binary files a/XplorePlane/Libs/Hardware/en-US/XP.Common.resources.dll and b/XplorePlane/Libs/Hardware/en-US/XP.Common.resources.dll differ diff --git a/XplorePlane/Libs/Hardware/zh-CN/XP.Common.resources.dll b/XplorePlane/Libs/Hardware/zh-CN/XP.Common.resources.dll index 22c555e..0c51f31 100644 Binary files a/XplorePlane/Libs/Hardware/zh-CN/XP.Common.resources.dll and b/XplorePlane/Libs/Hardware/zh-CN/XP.Common.resources.dll differ diff --git a/XplorePlane/Libs/Hardware/zh-TW/XP.Common.resources.dll b/XplorePlane/Libs/Hardware/zh-TW/XP.Common.resources.dll index a2be167..0f5892d 100644 Binary files a/XplorePlane/Libs/Hardware/zh-TW/XP.Common.resources.dll and b/XplorePlane/Libs/Hardware/zh-TW/XP.Common.resources.dll differ diff --git a/XplorePlane/Views/Main/MainWindow.xaml b/XplorePlane/Views/Main/MainWindow.xaml index b20e1fd..b640511 100644 --- a/XplorePlane/Views/Main/MainWindow.xaml +++ b/XplorePlane/Views/Main/MainWindow.xaml @@ -453,11 +453,11 @@ - + - + + diff --git a/XplorePlane/bin/Debug/net8.0-windows/App.config b/XplorePlane/bin/Debug/net8.0-windows/App.config index e686b60..079fa00 100644 --- a/XplorePlane/bin/Debug/net8.0-windows/App.config +++ b/XplorePlane/bin/Debug/net8.0-windows/App.config @@ -24,6 +24,13 @@ + + + + + + + diff --git a/XplorePlane/bin/Debug/net8.0-windows/XplorePlane.dll.config b/XplorePlane/bin/Debug/net8.0-windows/XplorePlane.dll.config index e686b60..079fa00 100644 --- a/XplorePlane/bin/Debug/net8.0-windows/XplorePlane.dll.config +++ b/XplorePlane/bin/Debug/net8.0-windows/XplorePlane.dll.config @@ -24,6 +24,13 @@ + + + + + + + diff --git a/XplorePlane/readme.txt b/XplorePlane/readme.txt index 073e91d..a443e55 100644 --- a/XplorePlane/readme.txt +++ b/XplorePlane/readme.txt @@ -47,7 +47,7 @@ 2、将telerik 升级到 2024.1.408.310;调整界面和主题;引入 硬件层依赖 √ 3、图像算子流程文件,保存文件后缀 .imw, image process workflow 缩写 √ 4、CNC保存文件后缀为.xp, 表示 XplorePlane CNC file 的缩写 -5、硬件层射线源控件的集成 +5、硬件层射线源控件的初步集成(采用库层面的自定义控件方式)