diff --git a/XplorePlane/App.config b/XplorePlane/App.config index c4fcc58..e686b60 100644 --- a/XplorePlane/App.config +++ b/XplorePlane/App.config @@ -9,14 +9,20 @@ - - - - - - - - + + + + + + + + + + + + + + diff --git a/XplorePlane/App.xaml.cs b/XplorePlane/App.xaml.cs index 180f1b3..9e2296a 100644 --- a/XplorePlane/App.xaml.cs +++ b/XplorePlane/App.xaml.cs @@ -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(); + 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(); @@ -99,14 +130,29 @@ namespace XplorePlane // 注册 Serilog 的 ILogger 实例 containerRegistry.RegisterInstance(Log.Logger); - // 注册 XplorePlane.Common.ILoggerService 适配器 - containerRegistry.RegisterSingleton(); + // 注册 XP.Common.ILoggerService 适配器 + containerRegistry.RegisterSingleton(); // 注册视图和视图模型 containerRegistry.RegisterForNavigation(); containerRegistry.Register(); + // 手动注册 RaySourceOperateView 的 View-ViewModel 映射 + // (库内 RaySourceModule 中此注册被注释掉了,需要在主项目补充) + containerRegistry.RegisterForNavigation(); + Log.Information("依赖注入容器配置完成"); } + + protected override void ConfigureModuleCatalog(IModuleCatalog moduleCatalog) + { + // 通用模块(注册 ILocalizationService、ILocalizationConfig)— 必须在 RaySourceModule 之前 + moduleCatalog.AddModule(); + + // 射线源模块(自动注册 IRaySourceService、IRaySourceFactory、RaySourceConfig) + moduleCatalog.AddModule(); + + base.ConfigureModuleCatalog(moduleCatalog); + } } } diff --git a/XplorePlane/Libs/Hardware/XplorePlane.Common.dll b/XplorePlane/Libs/Hardware/XplorePlane.Common.dll deleted file mode 100644 index 67b3fce..0000000 Binary files a/XplorePlane/Libs/Hardware/XplorePlane.Common.dll and /dev/null differ diff --git a/XplorePlane/Libs/Hardware/XplorePlane.Hardware.Detector.dll b/XplorePlane/Libs/Hardware/XplorePlane.Hardware.Detector.dll deleted file mode 100644 index e4de8f6..0000000 Binary files a/XplorePlane/Libs/Hardware/XplorePlane.Hardware.Detector.dll and /dev/null differ diff --git a/XplorePlane/Libs/Hardware/XplorePlane.Hardware.PLC.dll b/XplorePlane/Libs/Hardware/XplorePlane.Hardware.PLC.dll deleted file mode 100644 index ac3ef6c..0000000 Binary files a/XplorePlane/Libs/Hardware/XplorePlane.Hardware.PLC.dll and /dev/null differ diff --git a/XplorePlane/Libs/Hardware/XplorePlane.Hardware.RaySource.dll b/XplorePlane/Libs/Hardware/XplorePlane.Hardware.RaySource.dll deleted file mode 100644 index 096f80b..0000000 Binary files a/XplorePlane/Libs/Hardware/XplorePlane.Hardware.RaySource.dll and /dev/null differ diff --git a/XplorePlane/Libs/Native/BR.AN.PviServices.dll b/XplorePlane/Libs/Native/BR.AN.PviServices.dll new file mode 100644 index 0000000..6a6a038 Binary files /dev/null and b/XplorePlane/Libs/Native/BR.AN.PviServices.dll differ diff --git a/XplorePlane/Services/LoggerServiceAdapter.cs b/XplorePlane/Services/LoggerServiceAdapter.cs index 7dcf69d..003d252 100644 --- a/XplorePlane/Services/LoggerServiceAdapter.cs +++ b/XplorePlane/Services/LoggerServiceAdapter.cs @@ -1,6 +1,6 @@ using System; using Serilog; -using XplorePlane.Common.Logging.Interfaces; +using XP.Common.Logging.Interfaces; namespace XplorePlane.Services { diff --git a/XplorePlane/Views/RaySourcePanelView.xaml b/XplorePlane/Views/RaySourcePanelView.xaml index c1ef78e..426f103 100644 --- a/XplorePlane/Views/RaySourcePanelView.xaml +++ b/XplorePlane/Views/RaySourcePanelView.xaml @@ -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"> @@ -17,7 +18,7 @@ FontWeight="SemiBold" Foreground="#333333" Text="射线源" /> - + diff --git a/XplorePlane/XplorePlane.csproj b/XplorePlane/XplorePlane.csproj index 8bd03ff..571b88e 100644 --- a/XplorePlane/XplorePlane.csproj +++ b/XplorePlane/XplorePlane.csproj @@ -32,27 +32,21 @@ - - Libs\Hardware\XplorePlane.Common.dll + + Libs\Hardware\XP.Common.dll True - - Libs\Hardware\XplorePlane.Hardware.RaySource.dll - True - - - - Libs\Hardware\XplorePlane.Hardware.Detector.dll - True - - - - Libs\Hardware\XplorePlane.Hardware.PLC.dll + + Libs\Hardware\XP.Hardware.RaySource.dll True + + Libs\Native\BR.AN.PviServices.dll + True + @@ -106,6 +100,9 @@ ..\lib\RCWPF\2024.1.408.70.NoXaml\Telerik.Windows.Themes.Office2013.dll + + ..\lib\RCWPF\2024.1.408.70.NoXaml\Telerik.Windows.Themes.Crystal.dll + ..\lib\RCWPF\2024.1.408.70.NoXaml\Telerik.Windows.Controls.Data.dll @@ -138,6 +135,20 @@ PreserveNewest + + + PreserveNewest + zh-CN\%(Filename)%(Extension) + + + PreserveNewest + en-US\%(Filename)%(Extension) + + + PreserveNewest + zh-TW\%(Filename)%(Extension) + + PreserveNewest diff --git a/XplorePlane/bin/Debug/net8.0-windows/App.config b/XplorePlane/bin/Debug/net8.0-windows/App.config index c4fcc58..e686b60 100644 --- a/XplorePlane/bin/Debug/net8.0-windows/App.config +++ b/XplorePlane/bin/Debug/net8.0-windows/App.config @@ -9,14 +9,20 @@ - - - - - - - - + + + + + + + + + + + + + + diff --git a/XplorePlane/bin/Debug/net8.0-windows/XplorePlane.dll.config b/XplorePlane/bin/Debug/net8.0-windows/XplorePlane.dll.config index c4fcc58..e686b60 100644 --- a/XplorePlane/bin/Debug/net8.0-windows/XplorePlane.dll.config +++ b/XplorePlane/bin/Debug/net8.0-windows/XplorePlane.dll.config @@ -9,14 +9,20 @@ - - - - - - - - + + + + + + + + + + + + + +