using Prism.Mvvm; namespace UIShare.UIViewModel { /// /// VISA 连接配置(与 DeviceCommand.Base.Visa 保持字段一致)。 /// VISA 通过统一资源字符串寻址,无需区分 IP/端口,例如 /// TCPIP0::192.168.20.125::inst0::INSTR、USB0::0x0699::0x0408::C012345::INSTR。 /// public class VisaConfigVM : BindableBase { private string _resourceName = "TCPIP0::127.0.0.1::inst0::INSTR"; /// VISA 资源字符串(TCPIP / USB / GPIB / ASRL 等统一寻址)。 public string ResourceName { get => _resourceName; set => SetProperty(ref _resourceName, value); } private int _openTimeout = 3000; /// 打开会话超时(毫秒)。 public int OpenTimeout { get => _openTimeout; set => SetProperty(ref _openTimeout, value); } private int _ioTimeout = 3000; /// 读写 I/O 超时(毫秒)。 public int IOTimeout { get => _ioTimeout; set => SetProperty(ref _ioTimeout, value); } public VisaConfigVM() { } /// 拷贝构造,用于对话框编辑副本。 public VisaConfigVM(VisaConfigVM? src) { if (src == null) return; ResourceName = src.ResourceName; OpenTimeout = src.OpenTimeout; IOTimeout = src.IOTimeout; } /// 把字段拷回目标对象(保存时用)。 public void CopyTo(VisaConfigVM? dst) { if (dst == null) return; dst.ResourceName = ResourceName; dst.OpenTimeout = OpenTimeout; dst.IOTimeout = IOTimeout; } } }