123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172 |
- using MeterVision.db;
- using System;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using System.ComponentModel;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace MeterVision.model
- {
- public class StandDetailItem : INotifyPropertyChanged
- {
- public event PropertyChangedEventHandler PropertyChanged;
- public static Dictionary<int, double> LastUnitMapping = new Dictionary<int, double>
- {
- {0,0.0001 },
- {1,0.001 },
- {2,0.01 },
- {3,0.1 },
- {4,1 },
- {5,10 },
- {6,100 },
- {7,1000 },
- {8,10000 }
- };
- // 触发属性变更通知
- 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 StandId { get; set; }
- public string StandDetailId { get; set; }
- public string SrcImage { get; set; }
- private string _standValue;
- public string StandValue
- {
- get => _standValue;
- set
- {
- if(_standValue != value)
- {
- _standValue = value;
- OnPropertyChanged(nameof(StandValue));
- }
- }
- }
- private string _stationId;
- public string StationId
- {
- get => _stationId;
- set
- {
- if(_stationId != value)
- {
- _stationId = value;
- OnPropertyChanged(nameof(StationId));
- }
- }
- }
- private string _deviceSn;
- public string DeviceSn
- {
- get => _deviceSn;
- set
- {
- if(_deviceSn != value)
- {
- _deviceSn = value;
- OnPropertyChanged(nameof(DeviceSn));
- }
- }
- }
- private string _sampleTime;
- public string SampleTime
- {
- get => _sampleTime;
- set
- {
- if(_sampleTime != value)
- {
- _sampleTime = value;
- OnPropertyChanged(nameof(SampleTime));
- }
- }
- }
- private int _numCount;
- public int NumCount
- {
- get => _numCount;
- set
- {
- if(_numCount != value)
- {
- _numCount = value;
- OnPropertyChanged(nameof(NumCount));
- }
- }
- }
- private int _lastUnit;
- public int LastUnit
- {
- get => _lastUnit;
- set
- {
- if(_lastUnit != value)
- {
- _lastUnit = value;
- OnPropertyChanged(nameof(LastUnit));
- OnPropertyChanged(nameof(LastUnitName));
- }
- }
- }
- public string LastUnitName
- {
- get
- {
- if(LastUnitMapping.TryGetValue(LastUnit,out double lastUnit))
- {
- return lastUnit + "";
- }
- return "";
- }
- }
- public StandDetailItem()
- {
- }
- public StandDetailItem(TStandDetail standDetail)
- {
- StandId = standDetail.StandId;
- StandDetailId = standDetail.StandDetailId;
- SrcImage = standDetail.SrcImage;
- StandValue = standDetail.StandValue;
- StationId = standDetail.StationId;
- SampleTime = standDetail.SampleTime;
- NumCount = standDetail.NumCount;
- LastUnit = standDetail.LastUnit;
- }
- ///////////////////////////////////////////////////////////
- }
- }
|