#0014 初步集成射线源
This commit is contained in:
+14
-8
@@ -9,14 +9,20 @@
|
||||
<add key="Serilog:FileSizeLimitMB" value="100" />
|
||||
<add key="Serilog:RetainedFileCountLimit" value="30" />
|
||||
|
||||
<!-- 射线源配置 -->
|
||||
<add key="RaySource.Type" value="Comet225"/>
|
||||
<add key="RaySource.StationName" value="XRAY_STATION"/>
|
||||
<add key="RaySource.ConnectionTimeout" value="5000"/>
|
||||
<add key="RaySource.VoltageMin" value="20"/>
|
||||
<add key="RaySource.VoltageMax" value="225"/>
|
||||
<add key="RaySource.CurrentMin" value="10"/>
|
||||
<add key="RaySource.CurrentMax" value="1000"/>
|
||||
<!-- 射线源配置(key 格式: RaySource:xxx,与 ConfigLoader 一致) -->
|
||||
<add key="RaySource:PlcIpAddress" value="192.168.1.100" />
|
||||
<add key="RaySource:PlcPort" value="11160" />
|
||||
<add key="RaySource:StationNumber" value="1" />
|
||||
<add key="RaySource:CpuName" value="X20CP1584" />
|
||||
<add key="RaySource:ConnectionTimeout" value="5000" />
|
||||
<add key="RaySource:MinVoltage" value="20" />
|
||||
<add key="RaySource:MaxVoltage" value="225" />
|
||||
<add key="RaySource:MinCurrent" value="10" />
|
||||
<add key="RaySource:MaxCurrent" value="1000" />
|
||||
<add key="RaySource:WarmUpTimeout" value="300000" />
|
||||
<add key="RaySource:StartUpTimeout" value="180000" />
|
||||
<add key="RaySource:StatusPollingInterval" value="500" />
|
||||
<add key="RaySource:EnableAutoStatusMonitoring" value="true" />
|
||||
|
||||
<!-- 探测器配置 -->
|
||||
<add key="Detector.Type" value="Varex4343"/>
|
||||
|
||||
+49
-3
@@ -4,7 +4,13 @@ using XplorePlane.Views;
|
||||
using XplorePlane.ViewModels;
|
||||
using Prism.Ioc;
|
||||
using Prism.DryIoc;
|
||||
using Prism.Modularity;
|
||||
using Serilog;
|
||||
using XP.Common.Module;
|
||||
using XP.Hardware.RaySource.Module;
|
||||
using XP.Hardware.RaySource.Services;
|
||||
using XP.Hardware.RaySource.ViewModels;
|
||||
using XP.Hardware.RaySource.Views;
|
||||
|
||||
namespace XplorePlane
|
||||
{
|
||||
@@ -46,10 +52,26 @@ namespace XplorePlane
|
||||
|
||||
protected override void OnExit(ExitEventArgs e)
|
||||
{
|
||||
// 关闭并刷新日志
|
||||
Log.Information("========================================");
|
||||
Log.Information("XplorePlane 应用程序退出");
|
||||
Log.Information("========================================");
|
||||
|
||||
// 释放射线源资源
|
||||
try
|
||||
{
|
||||
var bootstrapper = AppBootstrapper.Instance;
|
||||
if (bootstrapper != null)
|
||||
{
|
||||
var raySourceService = bootstrapper.Container.Resolve<IRaySourceService>();
|
||||
raySourceService?.Dispose();
|
||||
Log.Information("射线源资源已释放");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error(ex, "射线源资源释放失败");
|
||||
}
|
||||
|
||||
Log.CloseAndFlush();
|
||||
base.OnExit(e);
|
||||
}
|
||||
@@ -89,6 +111,15 @@ namespace XplorePlane
|
||||
|
||||
public class AppBootstrapper : PrismBootstrapper
|
||||
{
|
||||
public static AppBootstrapper Instance { get; private set; }
|
||||
|
||||
public new IContainerProvider Container => base.Container;
|
||||
|
||||
public AppBootstrapper()
|
||||
{
|
||||
Instance = this;
|
||||
}
|
||||
|
||||
protected override Window CreateShell()
|
||||
{
|
||||
return Container.Resolve<MainWindow>();
|
||||
@@ -99,14 +130,29 @@ namespace XplorePlane
|
||||
// 注册 Serilog 的 ILogger 实例
|
||||
containerRegistry.RegisterInstance<ILogger>(Log.Logger);
|
||||
|
||||
// 注册 XplorePlane.Common.ILoggerService 适配器
|
||||
containerRegistry.RegisterSingleton<XplorePlane.Common.Logging.Interfaces.ILoggerService, Services.LoggerServiceAdapter>();
|
||||
// 注册 XP.Common.ILoggerService 适配器
|
||||
containerRegistry.RegisterSingleton<XP.Common.Logging.Interfaces.ILoggerService, Services.LoggerServiceAdapter>();
|
||||
|
||||
// 注册视图和视图模型
|
||||
containerRegistry.RegisterForNavigation<MainWindow>();
|
||||
containerRegistry.Register<MainViewModel>();
|
||||
|
||||
// 手动注册 RaySourceOperateView 的 View-ViewModel 映射
|
||||
// (库内 RaySourceModule 中此注册被注释掉了,需要在主项目补充)
|
||||
containerRegistry.RegisterForNavigation<RaySourceOperateView, RaySourceOperateViewModel>();
|
||||
|
||||
Log.Information("依赖注入容器配置完成");
|
||||
}
|
||||
|
||||
protected override void ConfigureModuleCatalog(IModuleCatalog moduleCatalog)
|
||||
{
|
||||
// 通用模块(注册 ILocalizationService、ILocalizationConfig)— 必须在 RaySourceModule 之前
|
||||
moduleCatalog.AddModule<CommonModule>();
|
||||
|
||||
// 射线源模块(自动注册 IRaySourceService、IRaySourceFactory、RaySourceConfig)
|
||||
moduleCatalog.AddModule<RaySourceModule>();
|
||||
|
||||
base.ConfigureModuleCatalog(moduleCatalog);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,6 +1,6 @@
|
||||
using System;
|
||||
using Serilog;
|
||||
using XplorePlane.Common.Logging.Interfaces;
|
||||
using XP.Common.Logging.Interfaces;
|
||||
|
||||
namespace XplorePlane.Services
|
||||
{
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
d:DesignHeight="150"
|
||||
xmlns:rayViews="clr-namespace:XP.Hardware.RaySource.Views;assembly=XP.Hardware.RaySource"
|
||||
d:DesignHeight="300"
|
||||
d:DesignWidth="200"
|
||||
mc:Ignorable="d">
|
||||
<Grid Background="#FFFFFF">
|
||||
@@ -17,7 +18,7 @@
|
||||
FontWeight="SemiBold" Foreground="#333333" Text="射线源" />
|
||||
</Border>
|
||||
<ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Auto">
|
||||
<StackPanel Margin="4" />
|
||||
<rayViews:RaySourceOperateView />
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
||||
@@ -32,27 +32,21 @@
|
||||
<!-- DLL 引用 -->
|
||||
<ItemGroup>
|
||||
<!-- 硬件库 DLL 引用 -->
|
||||
<Reference Include="XplorePlane.Common">
|
||||
<HintPath>Libs\Hardware\XplorePlane.Common.dll</HintPath>
|
||||
<Reference Include="XP.Common">
|
||||
<HintPath>Libs\Hardware\XP.Common.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
|
||||
<Reference Include="XplorePlane.Hardware.RaySource">
|
||||
<HintPath>Libs\Hardware\XplorePlane.Hardware.RaySource.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
|
||||
<Reference Include="XplorePlane.Hardware.Detector">
|
||||
<HintPath>Libs\Hardware\XplorePlane.Hardware.Detector.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
|
||||
<Reference Include="XplorePlane.Hardware.PLC">
|
||||
<HintPath>Libs\Hardware\XplorePlane.Hardware.PLC.dll</HintPath>
|
||||
<Reference Include="XP.Hardware.RaySource">
|
||||
<HintPath>Libs\Hardware\XP.Hardware.RaySource.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
|
||||
<!-- 原生依赖库引用 -->
|
||||
<Reference Include="BR.AN.PviServices">
|
||||
<HintPath>Libs\Native\BR.AN.PviServices.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Telerik.Windows.Controls">
|
||||
@@ -106,6 +100,9 @@
|
||||
<Reference Include="Telerik.Windows.Themes.Office2013">
|
||||
<HintPath>..\lib\RCWPF\2024.1.408.70.NoXaml\Telerik.Windows.Themes.Office2013.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Telerik.Windows.Themes.Crystal">
|
||||
<HintPath>..\lib\RCWPF\2024.1.408.70.NoXaml\Telerik.Windows.Themes.Crystal.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Telerik.Windows.Controls.Data">
|
||||
<HintPath>..\lib\RCWPF\2024.1.408.70.NoXaml\Telerik.Windows.Controls.Data.dll</HintPath>
|
||||
</Reference>
|
||||
@@ -138,6 +135,20 @@
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
|
||||
<!-- 本地化卫星程序集 -->
|
||||
<None Include="Libs\Hardware\zh-CN\*.dll" Condition="Exists('Libs\Hardware\zh-CN')">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<Link>zh-CN\%(Filename)%(Extension)</Link>
|
||||
</None>
|
||||
<None Include="Libs\Hardware\en-US\*.dll" Condition="Exists('Libs\Hardware\en-US')">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<Link>en-US\%(Filename)%(Extension)</Link>
|
||||
</None>
|
||||
<None Include="Libs\Hardware\zh-TW\*.dll" Condition="Exists('Libs\Hardware\zh-TW')">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<Link>zh-TW\%(Filename)%(Extension)</Link>
|
||||
</None>
|
||||
|
||||
<!-- 配置文件 -->
|
||||
<None Update="App.config">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
|
||||
@@ -9,14 +9,20 @@
|
||||
<add key="Serilog:FileSizeLimitMB" value="100" />
|
||||
<add key="Serilog:RetainedFileCountLimit" value="30" />
|
||||
|
||||
<!-- 射线源配置 -->
|
||||
<add key="RaySource.Type" value="Comet225"/>
|
||||
<add key="RaySource.StationName" value="XRAY_STATION"/>
|
||||
<add key="RaySource.ConnectionTimeout" value="5000"/>
|
||||
<add key="RaySource.VoltageMin" value="20"/>
|
||||
<add key="RaySource.VoltageMax" value="225"/>
|
||||
<add key="RaySource.CurrentMin" value="10"/>
|
||||
<add key="RaySource.CurrentMax" value="1000"/>
|
||||
<!-- 射线源配置(key 格式: RaySource:xxx,与 ConfigLoader 一致) -->
|
||||
<add key="RaySource:PlcIpAddress" value="192.168.1.100" />
|
||||
<add key="RaySource:PlcPort" value="11160" />
|
||||
<add key="RaySource:StationNumber" value="1" />
|
||||
<add key="RaySource:CpuName" value="X20CP1584" />
|
||||
<add key="RaySource:ConnectionTimeout" value="5000" />
|
||||
<add key="RaySource:MinVoltage" value="20" />
|
||||
<add key="RaySource:MaxVoltage" value="225" />
|
||||
<add key="RaySource:MinCurrent" value="10" />
|
||||
<add key="RaySource:MaxCurrent" value="1000" />
|
||||
<add key="RaySource:WarmUpTimeout" value="300000" />
|
||||
<add key="RaySource:StartUpTimeout" value="180000" />
|
||||
<add key="RaySource:StatusPollingInterval" value="500" />
|
||||
<add key="RaySource:EnableAutoStatusMonitoring" value="true" />
|
||||
|
||||
<!-- 探测器配置 -->
|
||||
<add key="Detector.Type" value="Varex4343"/>
|
||||
|
||||
@@ -9,14 +9,20 @@
|
||||
<add key="Serilog:FileSizeLimitMB" value="100" />
|
||||
<add key="Serilog:RetainedFileCountLimit" value="30" />
|
||||
|
||||
<!-- 射线源配置 -->
|
||||
<add key="RaySource.Type" value="Comet225"/>
|
||||
<add key="RaySource.StationName" value="XRAY_STATION"/>
|
||||
<add key="RaySource.ConnectionTimeout" value="5000"/>
|
||||
<add key="RaySource.VoltageMin" value="20"/>
|
||||
<add key="RaySource.VoltageMax" value="225"/>
|
||||
<add key="RaySource.CurrentMin" value="10"/>
|
||||
<add key="RaySource.CurrentMax" value="1000"/>
|
||||
<!-- 射线源配置(key 格式: RaySource:xxx,与 ConfigLoader 一致) -->
|
||||
<add key="RaySource:PlcIpAddress" value="192.168.1.100" />
|
||||
<add key="RaySource:PlcPort" value="11160" />
|
||||
<add key="RaySource:StationNumber" value="1" />
|
||||
<add key="RaySource:CpuName" value="X20CP1584" />
|
||||
<add key="RaySource:ConnectionTimeout" value="5000" />
|
||||
<add key="RaySource:MinVoltage" value="20" />
|
||||
<add key="RaySource:MaxVoltage" value="225" />
|
||||
<add key="RaySource:MinCurrent" value="10" />
|
||||
<add key="RaySource:MaxCurrent" value="1000" />
|
||||
<add key="RaySource:WarmUpTimeout" value="300000" />
|
||||
<add key="RaySource:StartUpTimeout" value="180000" />
|
||||
<add key="RaySource:StatusPollingInterval" value="500" />
|
||||
<add key="RaySource:EnableAutoStatusMonitoring" value="true" />
|
||||
|
||||
<!-- 探测器配置 -->
|
||||
<add key="Detector.Type" value="Varex4343"/>
|
||||
|
||||
Reference in New Issue
Block a user