| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- using SWRIS.Dtos;
- using SWRIS.Enums;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using System.ComponentModel;
- using System.Linq;
- namespace SWRIS.Models
- {
- public class DataCenterModel : INotifyPropertyChanged
- {
- public DataCenterModel(List<EquipmentModel> equipments, List<LimitData> limits)
- {
- if (equipments != null)
- {
- equipments = equipments.OrderBy(c => c.RopeNumber).ToList();
- foreach (var equipment in equipments)
- {
- var equipmentData = new EquipmentDataModel()
- {
- RopeNumber = equipment.RopeNumber,
- RopeName = equipment.RopeName,
- TrolleyId = equipment.TrolleyId,
- IpAddress = equipment.IpAddress,
- SerialNo = equipment.SerialNo,
- SensorCount = equipment.Parameter.SensorCount,
- SamplingStep = equipment.Parameter.SamplingStep,
- RopeLength = equipment.Parameter.WireRopeLength,
- LiftHightRatio = equipment.LiftHightRatio,
- DisableAlarm = equipment.DisableAlarm,
- InUseSensor = equipment.InUseSensor,
- VariationThreshold = App.Config.SpeedVariationThreshold
- };
- limits?.ForEach(limit =>
- {
- if (limit.RelatedRopes.Contains(equipment.RopeNumber))
- {
- equipmentData.Limits.Add(new LimitModel
- {
- Name = limit.Name,
- State = LimitState.Offline,
- SwitchIndex = limit.SwitchIndex,
- IsEnable = limit.IsEnable
- });
- }
- });
- Equipments.Add(equipmentData);
- }
- }
- }
- public ObservableCollection<EquipmentDataModel> Equipments { get; set; } = new ObservableCollection<EquipmentDataModel>();
- public ObservableCollection<FaultsMessageDto> Messages { get; set; } = new ObservableCollection<FaultsMessageDto>();
- public event PropertyChangedEventHandler PropertyChanged;
- protected internal virtual void OnPropertyChanged(string propertyName)
- {
- PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
- }
- }
- }
|