虚拟探测器与实时切换按钮的绑定

This commit is contained in:
zhengxuan.zhang
2026-05-15 16:51:21 +08:00
parent 8e9ef312ad
commit e9d388beb2
10 changed files with 153 additions and 19 deletions
@@ -7,7 +7,6 @@ using XP.Hardware.Detector.Abstractions.Enums;
using XP.Hardware.Detector.Config;
using XP.Hardware.Detector.Implementations;
using XP.Common.Logging.Interfaces;
namespace XP.Hardware.Detector.Factories
{
/// <summary>
@@ -54,6 +53,7 @@ namespace XP.Hardware.Detector.Factories
DetectorType.Varex => CreateVarexDetector(config),
//DetectorType.IRay => CreateIRayDetector(config),
DetectorType.Hamamatsu => throw new NotImplementedException("Hamamatsu 探测器尚未实现 | Hamamatsu detector not implemented yet"),
DetectorType.Simulated => CreateSimulatedDetector(config),
_ => throw new NotSupportedException($"不支持的探测器类型:{config.Type} | Unsupported detector type: {config.Type}")
};
@@ -113,7 +113,21 @@ namespace XP.Hardware.Detector.Factories
/// </summary>
public IEnumerable<DetectorType> GetSupportedTypes()
{
return new[] { DetectorType.Varex, DetectorType.IRay };
return new[] { DetectorType.Varex, DetectorType.IRay, DetectorType.Simulated };
}
/// <summary>
/// 创建软件模拟探测器 | Create simulated detector
/// </summary>
private IAreaDetector CreateSimulatedDetector(DetectorConfig config)
{
var simConfig = config as SimulatedDetectorConfig
?? new SimulatedDetectorConfig();
_logger?.Info("[DetectorFactory] 创建 SimulatedDetector,分辨率 {W}x{H},帧率 {FPS} fps",
simConfig.Width, simConfig.Height, simConfig.FrameRateFps);
return new SimulatedDetector(simConfig, _eventAggregator, _logger);
}
}
}