终端一体化运控平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

47 lines
1.7 KiB

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Collections.ObjectModel;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using BPASmartClient.Helper;
  8. using BPASmartClient.Model;
  9. using Microsoft.Toolkit.Mvvm.ComponentModel;
  10. using Microsoft.Toolkit.Mvvm.Input;
  11. namespace BPASmartClient.ViewModel
  12. {
  13. public class SystemSetViewModel : ObservableObject
  14. {
  15. public SystemSetViewModel()
  16. {
  17. if (SaveInfoCommand == null)
  18. {
  19. SaveInfoCommand = new Action(() =>
  20. {
  21. List<ushort> values = new List<ushort>();
  22. values.Clear();
  23. List<bool> bools = new List<bool>();
  24. bools.Clear();
  25. for (int i = 0; i < Json<KeepDataBase>.Data.parSets.Count; i++)
  26. {
  27. values.Clear();
  28. values.Add(Json<KeepDataBase>.Data.parSets[i].Minute);
  29. values.Add(Json<KeepDataBase>.Data.parSets[i].Second);
  30. bools.Add(Json<KeepDataBase>.Data.parSets[i].IsShield);
  31. //ModbusTcpHelper.GetInstance.Write((ushort)ModbusTcpHelper.GetInstance.GetWordAddress($"VW{116 + (i * 6)}"), WriteType.HoldingRegisters, values.ToArray());
  32. }
  33. //ModbusTcpHelper.GetInstance.Write((ushort)ModbusTcpHelper.GetInstance.GetBoolAddress("M260.0"), WriteType.Coils, bools.ToArray());
  34. });
  35. }
  36. }
  37. public ObservableCollection<ParSet> parSets { get; set; } = Json<KeepDataBase>.Data.parSets;
  38. public Action SaveInfoCommand { get; set; }
  39. }
  40. }