|
- using BPA.Helper;
- using BPASmartClient.MorkM.Model;
- using BPA.Helper;
- using System;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
-
- namespace BPASmartClient.MorkM.ViewModel
- {
- internal class ParSetViewModel : NotifyBase
- {
- public ParSetViewModel()
- {
- SaveInfoCommand = new Action(() =>
- {
- List<ushort> values = new List<ushort>();
- values.Clear();
-
- List<bool> bools = new List<bool>();
- bools.Clear();
-
- for (int i = 0; i < Json<MorksPar>.Data.parSets.Count; i++)
- {
- values.Clear();
- values.Add(Json<MorksPar>.Data.parSets[i].Minute);
- values.Add(Json<MorksPar>.Data.parSets[i].Second);
- bools.Add(Json<MorksPar>.Data.parSets[i].IsShield);
- ActionManage.GetInstance.Send(new WritePar() { Address = $"VW{116 + (i * 6)}", Value = values.ToArray() }, "WriteVW");
- }
- ActionManage.GetInstance.Send(new WritePar() { Address = "M260.0", Value = bools.ToArray() }, "WriteBools");
- Json<MorksPar>.Save();
- });
- }
-
- public Action SaveInfoCommand { get; set; }
-
- public ObservableCollection<ParSet> parSets { get; set; } = Json<MorksPar>.Data.parSets;
- }
- }
|