#0049 硬件层射线源控件的初步集成

This commit is contained in:
zhengxuan.zhang
2026-03-26 17:12:19 +08:00
parent da43dfc595
commit acc9b11942
14 changed files with 82 additions and 9 deletions
+7
View File
@@ -24,6 +24,13 @@
<add key="RaySource:StatusPollingInterval" value="500" />
<add key="RaySource:EnableAutoStatusMonitoring" value="true" />
<!-- SQLite 数据库配置 -->
<add key="Sqlite:DbFilePath" value="Data\XP.db" />
<add key="Sqlite:ConnectionTimeout" value="30" />
<add key="Sqlite:CreateIfNotExists" value="true" />
<add key="Sqlite:EnableWalMode" value="true" />
<add key="Sqlite:EnableSqlLogging" value="false" />
<!-- 探测器配置 -->
<add key="Detector.Type" value="Varex4343"/>
<add key="Detector.IPAddress" value="192.168.1.101"/>
+57 -6
View File
@@ -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<PipelineEditorViewModel>();
containerRegistry.Register<OperatorToolboxViewModel>();
// 注册硬件库的 ViewModel(供 ViewModelLocator 自动装配)
containerRegistry.Register<XP.Hardware.RaySource.ViewModels.RaySourceOperateViewModel>();
// 注册 SQLite 配置和数据库上下文(FilamentLifetimeService 依赖)
var sqliteConfig = XP.Common.Helpers.ConfigLoader.LoadSqliteConfig();
containerRegistry.RegisterInstance(sqliteConfig);
containerRegistry.RegisterSingleton<IDbContext, SqliteContext>();
// 手动注册射线源模块的所有服务(确保 DryIoc 容器中可用,避免模块加载顺序问题)
var raySourceConfig = XP.Hardware.RaySource.Config.ConfigLoader.LoadConfig();
containerRegistry.RegisterInstance(raySourceConfig);
containerRegistry.RegisterSingleton<XP.Hardware.RaySource.Abstractions.IRaySourceFactory, XP.Hardware.RaySource.Factories.RaySourceFactory>();
containerRegistry.RegisterSingleton<IRaySourceService, XP.Hardware.RaySource.Services.RaySourceService>();
containerRegistry.RegisterSingleton<XP.Hardware.RaySource.Services.IFilamentLifetimeService, XP.Hardware.RaySource.Services.FilamentLifetimeService>();
// 手动注册通用模块的服务(本地化、Dump)
containerRegistry.RegisterSingleton<ILocalizationConfig, LocalizationConfig>();
containerRegistry.RegisterSingleton<ILocalizationService, ResxLocalizationService>();
containerRegistry.RegisterSingleton<DumpConfig>(() => XP.Common.Helpers.ConfigLoader.LoadDumpConfig());
containerRegistry.RegisterSingleton<IDumpService, DumpService>();
Log.Information("依赖注入容器配置完成");
}
protected override void ConfigureModuleCatalog(IModuleCatalog moduleCatalog)
{
// 通用模块(注册 ILocalizationService、ILocalizationConfig)— 必须在 RaySourceModule 之前
moduleCatalog.AddModule<CommonModule>();
// 射线源模块(自动注册 IRaySourceService、IRaySourceFactory、RaySourceConfig
moduleCatalog.AddModule<RaySourceModule>();
// 所有模块服务已在 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<ILocalizationService>();
LocalizationExtension.Initialize(locService);
// 启动 Dump 服务
try
{
var dumpService = Container.Resolve<IDumpService>();
dumpService.Start();
}
catch (System.Exception ex)
{
Log.Warning(ex, "Dump 服务启动失败,跳过");
}
}
}
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+2 -2
View File
@@ -453,11 +453,11 @@
<ColumnDefinition Width="250*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="100" />
<RowDefinition Height="250" />
<RowDefinition Height="*" />
<RowDefinition Height="340" />
</Grid.RowDefinitions>
<views:RaySourceOperateView Grid.Row="0" Grid.ColumnSpan="2" />
<views1:RaySourceOperateView Grid.Row="0" Grid.ColumnSpan="2" />
<views:MotionControlPanelView
Grid.Row="1"
Grid.RowSpan="2"
+1
View File
@@ -27,6 +27,7 @@
<PackageReference Include="Serilog.Sinks.File" Version="7.0.0" />
<PackageReference Include="Serilog.Sinks.Debug" Version="3.0.0" />
<PackageReference Include="System.Data.SQLite" Version="1.0.118" />
<PackageReference Include="Microsoft.Data.Sqlite" Version="10.0.3" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="8.0.0" />
<PackageReference Include="Emgu.CV" Version="4.10.0.5680" />
<PackageReference Include="Emgu.CV.runtime.windows" Version="4.10.0.5680" />
@@ -24,6 +24,13 @@
<add key="RaySource:StatusPollingInterval" value="500" />
<add key="RaySource:EnableAutoStatusMonitoring" value="true" />
<!-- SQLite 数据库配置 -->
<add key="Sqlite:DbFilePath" value="Data\XP.db" />
<add key="Sqlite:ConnectionTimeout" value="30" />
<add key="Sqlite:CreateIfNotExists" value="true" />
<add key="Sqlite:EnableWalMode" value="true" />
<add key="Sqlite:EnableSqlLogging" value="false" />
<!-- 探测器配置 -->
<add key="Detector.Type" value="Varex4343"/>
<add key="Detector.IPAddress" value="192.168.1.101"/>
@@ -24,6 +24,13 @@
<add key="RaySource:StatusPollingInterval" value="500" />
<add key="RaySource:EnableAutoStatusMonitoring" value="true" />
<!-- SQLite 数据库配置 -->
<add key="Sqlite:DbFilePath" value="Data\XP.db" />
<add key="Sqlite:ConnectionTimeout" value="30" />
<add key="Sqlite:CreateIfNotExists" value="true" />
<add key="Sqlite:EnableWalMode" value="true" />
<add key="Sqlite:EnableSqlLogging" value="false" />
<!-- 探测器配置 -->
<add key="Detector.Type" value="Varex4343"/>
<add key="Detector.IPAddress" value="192.168.1.101"/>
+1 -1
View File
@@ -47,7 +47,7 @@
2、将telerik 升级到 2024.1.408.310;调整界面和主题;引入 硬件层依赖 √
3、图像算子流程文件,保存文件后缀 .imw, image process workflow 缩写 √
4、CNC保存文件后缀为.xp, 表示 XplorePlane CNC file 的缩写
5、硬件层射线源控件的集成
5、硬件层射线源控件的初步集成(采用库层面的自定义控件方式)