终端一体化运控平台
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.
 
 
 

44 regels
1.5 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 BPASmartClient.MorkS.Model;
  10. using Microsoft.Toolkit.Mvvm.ComponentModel;
  11. namespace BPASmartClient.MorkS.ViewModel
  12. {
  13. public class ParSetViewModel : ObservableObject
  14. {
  15. public ParSetViewModel()
  16. {
  17. SaveInfoCommand = new Action(() =>
  18. {
  19. List<ushort> values = new List<ushort>();
  20. values.Clear();
  21. List<bool> bools = new List<bool>();
  22. bools.Clear();
  23. for (int i = 0; i < Json<MorksPar>.Data.parSets.Count; i++)
  24. {
  25. values.Clear();
  26. values.Add(Json<MorksPar>.Data.parSets[i].Minute);
  27. values.Add(Json<MorksPar>.Data.parSets[i].Second);
  28. bools.Add(Json<MorksPar>.Data.parSets[i].IsShield);
  29. ActionManage.GetInstance.Send("WriteVW", new WritePar() { Address = $"VW{116 + (i * 6)}", Value = values.ToArray() });
  30. }
  31. ActionManage.GetInstance.Send("WriteBools", new WritePar() { Address = "M260.0", Value = bools.ToArray() });
  32. Json<MorksPar>.Save();
  33. });
  34. }
  35. public Action SaveInfoCommand { get; set; }
  36. public ObservableCollection<ParSet> parSets { get; set; } = Json<MorksPar>.Data.parSets;
  37. }
  38. }