using MeterVision.db; using MeterVision.Util; using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Text; using System.Threading.Tasks; namespace MeterVision.model { public class StationItem : INotifyPropertyChanged { public static List> MeterTypeList = new List>() { //new KeyValuePair(0,"0 - 未知"), new KeyValuePair(1, "1 - 数字+指针"), new KeyValuePair(2, "2 - 全指针"), new KeyValuePair(3, "3 - 全数字") }; public static List> FlowRateList = new List>() { new KeyValuePair(3, "DN15 - 3"), new KeyValuePair(5, "DN20 - 5"), new KeyValuePair(8, "DN25 - 8"), new KeyValuePair(12, "DN32 - 12"), new KeyValuePair(20, "DN40 - 20"), new KeyValuePair(32, "DN50 - 32"), new KeyValuePair(60, "DN65 - 60"), new KeyValuePair(79, "DN80 - 79"), new KeyValuePair(125, "DN100 - 125"), new KeyValuePair(200, "DN125 - 200"), new KeyValuePair(312, "DN150 - 312"), new KeyValuePair(500, "DN200 - 500"), new KeyValuePair(787, "DN250 - 787"), new KeyValuePair(1250, "DN300 - 1250"), new KeyValuePair(2000, "DN400 - 2000"), new KeyValuePair(3125, "DN500 - 3125"), new KeyValuePair(5000, "DN600 - 5000"), new KeyValuePair(7875, "DN800 - 7875"), }; public static List UnitList = new List { 1000,100,10,1,0.1,0.01,0.001,0.0001 }; public event PropertyChangedEventHandler PropertyChanged; protected virtual void OnPropertyChanged(string propertyName) { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } private int _index; public int Index { get => _index; set { if (_index != value) { _index = value; OnPropertyChanged(nameof(Index)); } } } public string Id { get; set; } public string StationId { get; set; } private string _stationName; public string StationName { get => _stationName; set { if(_stationName != value) { _stationName = value; OnPropertyChanged(nameof(StationName)); } } } public string DeviceSn { get; set; } public string StandId { get; set; } private int _meterType; public int MeterType { get => _meterType; set { if (_meterType != value) { _meterType = value; OnPropertyChanged(nameof(MeterType)); OnPropertyChanged(nameof(MeterTypeName)); } } } public string MeterTypeName => Get_MeterTypeName(); private double _brightVal; public double BrightVal { get => _brightVal; set { if(_brightVal != value) { _brightVal = value; OnPropertyChanged(nameof(BrightVal)); } } } private int _flowRate; public int FlowRate { get => _flowRate; set { if(_flowRate != value) { _flowRate = value; OnPropertyChanged(nameof(FlowRate)); } } } private string _dialRegion; public string DialRegion { get => _dialRegion; set { if(_dialRegion != value) { _dialRegion = value; OnPropertyChanged(nameof(DialRegion)); } } } private int _numCount; public int NumCount { get => _numCount; set { if(_numCount != value) { _numCount = value; OnPropertyChanged(nameof(NumCount)); OnPropertyChanged(nameof(NumCountName)); } } } public string NumCountName { get { if(MeterType == 1 || MeterType == 3) { return NumCount + ""; } return ""; } } private int _indCount; public int IndCount { get => _indCount; set { if(_indCount != value) { _indCount = value; OnPropertyChanged(nameof(IndCount)); OnPropertyChanged(nameof(IndCountName)); } } } public string IndCountName { get { if(MeterType == 1 || MeterType == 2) { return IndCount + ""; } return ""; } } private string _numRegion; public string NumRegion { get => _numRegion; set { if(_numRegion != value) { _numRegion = value; OnPropertyChanged(nameof(NumRegion)); OnPropertyChanged(nameof(NumRegionName)); } } } public string NumRegionName { get { if(MeterType == 1 || MeterType == 3) { return NumRegion; } return ""; } } private string _htReigon; public string HtRegion { get => _htReigon; set { if(_htReigon != value) { _htReigon = value; OnPropertyChanged(nameof(HtRegion)); OnPropertyChanged(nameof(HtRegionName)); } } } public string HtRegionName { get { if(MeterType == 2) { return HtRegion; } return ""; } } private double _lastNumUnit; public double LastNumUnit { get => _lastNumUnit; set { if(_lastNumUnit != value) { _lastNumUnit = value; OnPropertyChanged(nameof(LastNumUnit)); OnPropertyChanged(nameof(LastNumUnitName)); } } } public string LastNumUnitName { get { if(MeterType == 1 || MeterType == 3) { return LastNumUnit + ""; } return ""; } } private double _lastIndUnit; public double LastIndUnit { get => _lastIndUnit; set { if(_lastIndUnit != value) { _lastIndUnit = value; OnPropertyChanged(nameof(LastIndUnit)); OnPropertyChanged(nameof(LastIndUnitName)); } } } public string LastIndUnitName { get { if(MeterType == 2) { return LastIndUnit + ""; } return ""; } } private double _lastValue; public double LastValue { get => _lastValue; set { if(_lastValue != value) { _lastValue = value; OnPropertyChanged(nameof(LastValue)); } } } private string _lastTime; public string LastTime { //get => ThisApp.ConvertDateFormat(_lastTime); get => _lastTime; set { if(_lastTime != value) { _lastTime = value; OnPropertyChanged(nameof(LastTime)); } } } public string LastTimeName => ThisApp.ConvertDateFormat(LastTime); private string _createTime; public string CreateTime { get => _createTime; set { if(_createTime != value) { _createTime = value; OnPropertyChanged(nameof(CreateTime)); } } } public StationItem() { } public StationItem(TStation tStation) { ObjectHelper.CopyMatchingFields(tStation, this); } private string Get_MeterTypeName() { switch (MeterType) { case 1: return "数字+指针"; case 2: return "全指针"; case 3: return "全数字"; case 4: return "LED表"; case 5: return "压力表"; default: return "非水表"; } } } }