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

50 lines
1.6 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 BPA.Helper;
  8. using BPASmartClient.Model;
  9. using BPASmartClient.MorkS3.Model;
  10. using BPA.Helper;
  11. namespace BPASmartClient.MorkS3.ViewModel
  12. {
  13. public class ParSetViewModel : NotifyBase
  14. {
  15. public ParSetViewModel()
  16. {
  17. SaveInfoCommand = new BPARelayCommand(SaveSettingData);
  18. ActionManage.GetInstance.Register(SaveSettingData, "初始化设定煮面时间");
  19. }
  20. public BPARelayCommand SaveInfoCommand { get; set; }
  21. public ObservableCollection<ParSet> parSets { get; set; } = Json<MorksPar>.Data.parSets;
  22. private void SaveSettingData()
  23. {
  24. List<ushort> values = new List<ushort>();
  25. values.Clear();
  26. List<bool> bools = new List<bool>();
  27. bools.Clear();
  28. for (int i = 0; i < Json<MorksPar>.Data.parSets.Count; i++)
  29. {
  30. values.Clear();
  31. values.Add(Json<MorksPar>.Data.parSets[i].Minute);
  32. values.Add(Json<MorksPar>.Data.parSets[i].Second);
  33. bools.Add(Json<MorksPar>.Data.parSets[i].IsShield);
  34. ActionManage.GetInstance.Send("WriteVW", new WritePar() { Address = $"VW{116 + (i * 6)}", Value = values.ToArray() });
  35. }
  36. ActionManage.GetInstance.Send("WriteBools", new WritePar() { Address = "M260.0", Value = bools.ToArray() });
  37. Json<MorksPar>.Save();
  38. }
  39. }
  40. }