N36600修改

This commit is contained in:
hsc
2026-07-15 17:21:18 +08:00
parent 8e44be4894
commit 0ed080f63c
5 changed files with 42 additions and 37 deletions

View File

@@ -229,26 +229,9 @@ namespace DeviceCommand.Device
return await WriteReadAsync($"MEAS:VAP?{SCPIDelimiter}", SCPIDelimiter, ct);
}
/// <summary>
/// 3.5.5 查询通道输出端子上测得的电池容量
/// </summary>
public virtual async Task<string> (CancellationToken ct = default)
{
// 修正:去除前缀冒号
return await WriteReadAsync($"MEAS:CAP?{SCPIDelimiter}", SCPIDelimiter, ct);
}
/// <summary>
/// 3.5.6 查询通道输出端子上测得的恒流输出时间长度 (单位: ms)
/// </summary>
public virtual async Task<string> (CancellationToken ct = default)
{
// 修正:去除前缀冒号
return await WriteReadAsync($"MEAS:TIM:CC?{SCPIDelimiter}", SCPIDelimiter, ct);
}
/// <summary>
/// 3.5.7 查询通道输出端子上测得的输出时间长度
/// 3.5.5 查询通道输出端子上测得的输出时间长度
/// </summary>
public virtual async Task<string> (CancellationToken ct = default)
{
@@ -286,7 +269,7 @@ namespace DeviceCommand.Device
{
// 修正:去除前缀冒号
string = ? "ON" : "OFF";
await SendAsync($"OUTP:TIM {状态}{SCPIDelimiter}", ct);
await SendAsync($"OUTP:TIME {状态}{SCPIDelimiter}", ct);
}
/// <summary>
@@ -295,7 +278,7 @@ namespace DeviceCommand.Device
public virtual async Task (double , CancellationToken ct = default)
{
// 修正:去除前缀冒号
string cmd = string.Format(CultureInfo.InvariantCulture, "OUTP:TIM:DATA {0:F1}{1}", , SCPIDelimiter);
string cmd = string.Format(CultureInfo.InvariantCulture, "OUTP:TIME:DATA {0:F1}{1}", , SCPIDelimiter);
await SendAsync(cmd, ct);
}
@@ -400,7 +383,14 @@ namespace DeviceCommand.Device
string cmd = string.Format(CultureInfo.InvariantCulture, "VOLT:LIM {0:F3}{1}", , SCPIDelimiter);
await SendAsync(cmd, ct);
}
/// <summary>
/// 3.7.2.9 清除电压上限限制(恢复为设备物理允许的最大电压值)
/// </summary>
public virtual async Task (CancellationToken ct = default)
{
// 发送 MAXimum 设为最大值以达到“清除限制”的效果
await SendAsync($"VOLT:LIMIT MAX{SCPIDelimiter}", ct); // 对应手册 3.7.2.8
}
/// <summary>
/// 3.7.3.1 设置输出功率值 (W)
/// </summary>

View File

@@ -21,6 +21,12 @@ namespace DeviceEditModule
containerRegistry.RegisterForNavigation<N69200View>("N69200View");
containerRegistry.RegisterForNavigation<SDS2000X_HDView>("SDS2000X_HDView");
containerRegistry.RegisterForNavigation<SPAW7000View>("SPAW7000View");
containerRegistry.Register<IT7800EViewModel>();
containerRegistry.Register<N36200ViewModel>();
containerRegistry.Register<N36600ViewModel>();
containerRegistry.Register<N69200ViewModel>();
containerRegistry.Register<SDS2000X_HDViewModel>();
containerRegistry.Register<SPAW7000ViewModel>();
}
}
}

View File

@@ -9,7 +9,7 @@
xmlns:converters="clr-namespace:UIShare.Converters;assembly=UIShare"
mc:Ignorable="d"
prism:ViewModelLocator.AutoWireViewModel="True"
Height="850" Width="900">
Height="900" Width="900">
<!-- 此窗口独立开启 ShowInTaskbar以支持最小化后在任务栏恢复 -->
<prism:Dialog.WindowStyle>
@@ -124,7 +124,7 @@
<!-- 标题栏 -->
<RowDefinition Height="38"/>
<!-- Tab 标签条 -->
<RowDefinition Height="40"/>
<RowDefinition Height="80"/>
<!-- 内容区 -->
<RowDefinition Height="*"/>
</Grid.RowDefinitions>

View File

@@ -7,7 +7,7 @@
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:converters="clr-namespace:UIShare.Converters;assembly=UIShare"
mc:Ignorable="d"
prism:ViewModelLocator.AutoWireViewModel="True"
prism:ViewModelLocator.AutoWireViewModel="False"
d:DesignHeight="760" d:DesignWidth="860">
<UserControl.Resources>

View File

@@ -127,26 +127,37 @@ namespace TestingModule.ViewModels
if (SelectedDevice == null) return;
var type = SelectedDevice.DeviceType.Split('.').Last();
var viewName = type + "View";
var vmName = type + "ViewModel"; // 按照命名规范拼接出对应的 VM 类型名
try
{
// 1. 先确保弹窗管理器窗口已打开(首次 Show后续只追加 Tab
// 1. 先确保弹窗管理器窗口已打开
if (_dialogWindow == null || !_dialogWindow.IsVisible)
{
_dialogService.Show("DialogMangerView");
// 找到刚刚被 DialogService 打开的窗口(按 DataContext 类型名匹配)
_dialogWindow = System.Windows.Application.Current.Windows
.OfType<System.Windows.Window>()
.FirstOrDefault(w => w.DataContext?.GetType().Name == "DialogMangerViewModel");
}
// 2. 从容器按注册名解析设备编辑 View
// 2. 从当前专属容器解析设备编辑 View 实例
var view = _containerProvider.Resolve<object>(viewName) as System.Windows.FrameworkElement;
if (view == null) return;
// 3. 通过反射调用 ViewModel 上的 Initialize(deviceName) 方法,
// 避免 TestingModule 直接引用 DeviceEditModule 的类型
// 3. 关键:从同一个台架的专属容器中解析出该设备对应的 ViewModel 实例
// 从而实现:不同的台架(不同的专属 _containerProvider解析出各自独立的 VM 实例
var vmType = Assembly.Load("DeviceEditModule").GetType($"DeviceEditModule.ViewModels.{vmName}");
if (vmType != null)
{
var scopedViewModel = _containerProvider.Resolve(vmType);
if (scopedViewModel != null)
{
// 手动绑定 DataContext将其锁死在当前作用域内
view.DataContext = scopedViewModel;
}
}
// 4. 调用 ViewModel 上的 Initialize 方法
var vm = view.DataContext;
if (vm != null)
{
@@ -154,18 +165,16 @@ namespace TestingModule.ViewModels
initMethod?.Invoke(vm, new object[] { SelectedDevice.DeviceName });
}
// 4. 发布事件 → DialogMangerViewModel 接收后将此 View 添加为 Tab
// 标题格式:{当前作用域} - {设备名称}
// 去重依据:设备硬件指纹(同一物理设备不重复打开)
// 5. 发布事件,将绑定好独立 VM 的 View 实例作为 Tab 载入
var fingerprint = DeviceManager.ExtractHardwareFingerprint(SelectedDevice);
_eventAggregator.GetEvent<AddDialogTabEvent>().Publish(new DialogTabInfo
{
Title = $"{_globalInfo.CurrentScope} - {SelectedDevice.DeviceName}",
Title = $"{_globalInfo.CurrentScope} - {SelectedDevice.DeviceName}",
Fingerprint = fingerprint,
Content = view
Content = view
});
// 5. 窗口置顶(确保用户看到新增的 Tab
// 6. 窗口置顶
if (_dialogWindow != null && _dialogWindow.IsVisible)
{
if (_dialogWindow.WindowState == System.Windows.WindowState.Minimized)