AppSettings.cs 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. using System;
  2. namespace APS7100TestTool.Models
  3. {
  4. /// <summary>
  5. /// 应用程序设置
  6. /// </summary>
  7. public class AppSettings
  8. {
  9. // APS7100 连接设置
  10. public bool AutoConnectAPS7100 { get; set; } = false;
  11. public string APS7100ConnectionType { get; set; } = "Serial"; // Serial or Ethernet
  12. public string APS7100ComPort { get; set; } = "";
  13. public int APS7100BaudRate { get; set; } = 9600;
  14. public string APS7100IpAddress { get; set; } = "192.168.1.100";
  15. public int APS7100Port { get; set; } = 2268;
  16. // PSW250 连接设置
  17. public bool AutoConnectPSW250 { get; set; } = false;
  18. public string PSW250ConnectionType { get; set; } = "Serial"; // Serial or Ethernet
  19. public string PSW250ComPort { get; set; } = "";
  20. public int PSW250BaudRate { get; set; } = 9600;
  21. public string PSW250IpAddress { get; set; } = "192.168.1.101";
  22. public int PSW250Port { get; set; } = 2268;
  23. // Modbus 服务设置
  24. public bool AutoStartModbus { get; set; } = false;
  25. public int ModbusPort { get; set; } = 502;
  26. public string ModbusBindIpAddress { get; set; } = "0.0.0.0"; // 绑定IP地址,0.0.0.0表示所有接口
  27. public string ModbusConfigPath { get; set; } = ""; // 自动加载的配置文件路径
  28. // 心跳寄存器地址设置
  29. public ushort HeartbeatRegisterAddress { get; set; } = 1; // 心跳寄存器地址(APP运行心跳)
  30. public ushort DeviceStatusRegisterAddress { get; set; } = 2; // 设备状态寄存器地址
  31. // 启动行为设置
  32. public bool StartMinimized { get; set; } = false; // 启动时最小化到托盘
  33. // 更新时间
  34. public DateTime LastUpdated { get; set; } = DateTime.Now;
  35. }
  36. /// <summary>
  37. /// 设备连接信息(用于状态显示)
  38. /// </summary>
  39. public class DeviceConnectionInfo
  40. {
  41. public DeviceType DeviceType { get; set; }
  42. public bool IsConnected { get; set; }
  43. public string ConnectionType { get; set; } = "";
  44. public string ConnectionInfo { get; set; } = "";
  45. public string DeviceIdentification { get; set; } = "";
  46. public bool OutputState { get; set; }
  47. public double Voltage { get; set; }
  48. public double Current { get; set; }
  49. public double Power { get; set; }
  50. public double Frequency { get; set; }
  51. public double PowerFactor { get; set; }
  52. public DateTime LastUpdateTime { get; set; }
  53. public string ErrorMessage { get; set; } = "";
  54. }
  55. }