上机测试优化2
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
using UIShare.PubEvent;
|
using UIShare.PubEvent;
|
||||||
using UIShare.ViewModelBase;
|
using UIShare.ViewModelBase;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
|
||||||
namespace ADP.ViewModels.Dialogs
|
namespace ADP.ViewModels.Dialogs
|
||||||
{
|
{
|
||||||
@@ -22,8 +23,8 @@ namespace ADP.ViewModels.Dialogs
|
|||||||
set => SetProperty(ref _Message, value);
|
set => SetProperty(ref _Message, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
private string _Icon= $"pack://siteoforigin:,,,/Resources/Images/info.png";
|
private ImageSource _Icon = new System.Windows.Media.Imaging.BitmapImage(new System.Uri("pack://application:,,,/Images/info.png"));
|
||||||
public string Icon
|
public ImageSource Icon
|
||||||
{
|
{
|
||||||
get => _Icon;
|
get => _Icon;
|
||||||
set => SetProperty(ref _Icon, value);
|
set => SetProperty(ref _Icon, value);
|
||||||
@@ -101,13 +102,15 @@ namespace ADP.ViewModels.Dialogs
|
|||||||
Title = parameters.GetValue<string>("Title");
|
Title = parameters.GetValue<string>("Title");
|
||||||
Message = parameters.GetValue<string>("Message");
|
Message = parameters.GetValue<string>("Message");
|
||||||
var iconKey = parameters.GetValue<string>("Icon"); // info / error / warn
|
var iconKey = parameters.GetValue<string>("Icon"); // info / error / warn
|
||||||
Icon = iconKey switch
|
var bmp = (ImageSource)new System.Windows.Media.Imaging.BitmapImage(new System.Uri(iconKey switch
|
||||||
{
|
{
|
||||||
"info" => $"pack://siteoforigin:,,,/Resources/Images/info.png",
|
"info" => "pack://application:,,,/Images/info.png",
|
||||||
"error" => $"pack://siteoforigin:,,,/Resources/Images/error.png",
|
"error" => "pack://application:,,,/Images/error.png",
|
||||||
"warn" => $"pack://siteoforigin:,,,/Resources/Images/warning.png",
|
"warn" => "pack://application:,,,/Images/warning.png",
|
||||||
_ => $"pack://siteoforigin:,,,/Resources/Images/info.png" // 默认
|
_ => "pack://application:,,,/Images/info.png"
|
||||||
};
|
}));
|
||||||
|
bmp.Freeze();
|
||||||
|
Icon = bmp;
|
||||||
|
|
||||||
|
|
||||||
ShowYes = parameters.GetValue<bool>("ShowYes");
|
ShowYes = parameters.GetValue<bool>("ShowYes");
|
||||||
|
|||||||
@@ -109,10 +109,34 @@ namespace DeviceCommand.Devices
|
|||||||
/// 设置电子负载的基本工作模式 (INPut:FUNCtion <mode>)
|
/// 设置电子负载的基本工作模式 (INPut:FUNCtion <mode>)
|
||||||
/// (支持 CC, CV, CR, CP, CCD, CVD, CRD, CPD, OCP, OPP, ESR, MPP, SWEEP 等)
|
/// (支持 CC, CV, CR, CP, CCD, CVD, CRD, CPD, OCP, OPP, ESR, MPP, SWEEP 等)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual async Task 设置负载模式(string 模式, CancellationToken ct = default)
|
public enum DeviceWorkMode
|
||||||
{
|
{
|
||||||
string modeUpper = 模式.ToUpper();
|
CC,
|
||||||
await SendAsync($"INPut:FUNCtion {modeUpper}{ScpiDelimiter}", ct);
|
CV,
|
||||||
|
CR,
|
||||||
|
CP,
|
||||||
|
CCD,
|
||||||
|
ESR,
|
||||||
|
AUTO,
|
||||||
|
DISCHARGE,
|
||||||
|
CHARGE,
|
||||||
|
OCP,
|
||||||
|
CVD,
|
||||||
|
CRD,
|
||||||
|
MPP,
|
||||||
|
CVCC,
|
||||||
|
CRCC,
|
||||||
|
CPCC,
|
||||||
|
CVCR,
|
||||||
|
WAVE,
|
||||||
|
SWEEP,
|
||||||
|
OPP,
|
||||||
|
CPD,
|
||||||
|
SZ
|
||||||
|
}
|
||||||
|
public virtual async Task 设置负载模式(DeviceWorkMode 模式, CancellationToken ct = default)
|
||||||
|
{
|
||||||
|
await SendAsync($"INPut:FUNCtion {Enum.GetName(模式)}{ScpiDelimiter}", ct);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -32,12 +32,13 @@ namespace DeviceCommand.Devices
|
|||||||
await SendAsync($"*CLS{ScpiDelimiter}", ct);
|
await SendAsync($"*CLS{ScpiDelimiter}", ct);
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查询错误信息
|
/// 查询错误信息 发hsl居然可以但是手册上没有而且软件上也用不了这个命令
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual async Task<string> 查询错误信息(CancellationToken ct = default)
|
//public virtual async Task<string> 查询错误信息(CancellationToken ct = default)
|
||||||
{
|
//{
|
||||||
return await WriteReadAsync($":SYSTem:ERRor?{ScpiDelimiter}", ScpiDelimiter, ct); //[cite: 1]
|
// string query = string.Format(":SYSTem:ERRor?", ScpiDelimiter);
|
||||||
}
|
// return await WriteReadAsync(query, ScpiDelimiter, ct);
|
||||||
|
//}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 读取功率分析仪识别字符串(制造商、产品型号、系统 SN、软件版本号)
|
/// 读取功率分析仪识别字符串(制造商、产品型号、系统 SN、软件版本号)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using System.Threading;
|
|||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using UIShare.GlobalVariable;
|
using UIShare.GlobalVariable;
|
||||||
using UIShare.ViewModelBase;
|
using UIShare.ViewModelBase;
|
||||||
|
using static DeviceCommand.Devices.N69200;
|
||||||
|
|
||||||
namespace DeviceEditModule.ViewModels
|
namespace DeviceEditModule.ViewModels
|
||||||
{
|
{
|
||||||
@@ -49,9 +50,9 @@ namespace DeviceEditModule.ViewModels
|
|||||||
|
|
||||||
#region 输入参数属性
|
#region 输入参数属性
|
||||||
|
|
||||||
private string _selectedMode = "CC";
|
private DeviceWorkMode _selectedMode = DeviceWorkMode.CC;
|
||||||
/// <summary>工作模式:CC / CV / CP / CR。</summary>
|
/// <summary>工作模式:CC / CV / CP / CR。</summary>
|
||||||
public string SelectedMode
|
public DeviceWorkMode SelectedMode
|
||||||
{
|
{
|
||||||
get => _selectedMode;
|
get => _selectedMode;
|
||||||
set => SetProperty(ref _selectedMode, value);
|
set => SetProperty(ref _selectedMode, value);
|
||||||
@@ -177,27 +178,26 @@ namespace DeviceEditModule.ViewModels
|
|||||||
|
|
||||||
SetLoadValueCommand = new DelegateCommand(async () => await Exec(async () =>
|
SetLoadValueCommand = new DelegateCommand(async () => await Exec(async () =>
|
||||||
{
|
{
|
||||||
var mode = SelectedMode.ToUpperInvariant();
|
switch (SelectedMode)
|
||||||
switch (mode)
|
|
||||||
{
|
{
|
||||||
case "CC":
|
case DeviceWorkMode.CC:
|
||||||
await _device!.设置恒电流CC(LoadValue, Ct());
|
await _device!.设置恒电流CC(LoadValue, Ct());
|
||||||
AppendLog($"恒流 CC 已设为 {LoadValue} A");
|
AppendLog($"恒流 CC 已设为 {LoadValue} A");
|
||||||
break;
|
break;
|
||||||
case "CV":
|
case DeviceWorkMode.CV:
|
||||||
await _device!.设置恒电压CV(LoadValue, Ct());
|
await _device!.设置恒电压CV(LoadValue, Ct());
|
||||||
AppendLog($"恒压 CV 已设为 {LoadValue} V");
|
AppendLog($"恒压 CV 已设为 {LoadValue} V");
|
||||||
break;
|
break;
|
||||||
case "CP":
|
case DeviceWorkMode.CP:
|
||||||
await _device!.设置恒功率CP(LoadValue, Ct());
|
await _device!.设置恒功率CP(LoadValue, Ct());
|
||||||
AppendLog($"恒功率 CP 已设为 {LoadValue} W");
|
AppendLog($"恒功率 CP 已设为 {LoadValue} W");
|
||||||
break;
|
break;
|
||||||
case "CR":
|
case DeviceWorkMode.CR:
|
||||||
await _device!.设置恒电阻CR(LoadValue, Ct());
|
await _device!.设置恒电阻CR(LoadValue, Ct());
|
||||||
AppendLog($"恒电阻 CR 已设为 {LoadValue} Ω");
|
AppendLog($"恒电阻 CR 已设为 {LoadValue} Ω");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
AppendLog($"未知模式 {SelectedMode},无法设置设定值");
|
AppendLog($"模式 {SelectedMode} 不支持设置设定值");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|||||||
Reference in New Issue
Block a user