123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398 |
- 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<KeyValuePair<int, string>> MeterTypeList =
- new List<KeyValuePair<int, string>>()
- {
- //new KeyValuePair<int, string>(0,"0 - 未知"),
- new KeyValuePair<int, string>(1, "1 - 数字+指针"),
- new KeyValuePair<int, string>(2, "2 - 全指针"),
- new KeyValuePair<int, string>(3, "3 - 全数字")
- };
- public static List<KeyValuePair<int, string>> FlowRateList =
- new List<KeyValuePair<int, string>>()
- {
- new KeyValuePair<int, string>(3, "DN15 - 3"),
- new KeyValuePair<int, string>(5, "DN20 - 5"),
- new KeyValuePair<int, string>(8, "DN25 - 8"),
- new KeyValuePair<int, string>(12, "DN32 - 12"),
- new KeyValuePair<int, string>(20, "DN40 - 20"),
- new KeyValuePair<int, string>(32, "DN50 - 32"),
- new KeyValuePair<int, string>(60, "DN65 - 60"),
- new KeyValuePair<int, string>(79, "DN80 - 79"),
- new KeyValuePair<int, string>(125, "DN100 - 125"),
- new KeyValuePair<int, string>(200, "DN125 - 200"),
- new KeyValuePair<int, string>(312, "DN150 - 312"),
- new KeyValuePair<int, string>(500, "DN200 - 500"),
- new KeyValuePair<int, string>(787, "DN250 - 787"),
- new KeyValuePair<int, string>(1250, "DN300 - 1250"),
- new KeyValuePair<int, string>(2000, "DN400 - 2000"),
- new KeyValuePair<int, string>(3125, "DN500 - 3125"),
- new KeyValuePair<int, string>(5000, "DN600 - 5000"),
- new KeyValuePair<int, string>(7875, "DN800 - 7875"),
- };
- public static List<double> UnitList = new List<double>
- {
- 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));
- OnPropertyChanged(nameof(LastUnitName));
- OnPropertyChanged(nameof(FeatureRegionName));
- OnPropertyChanged(nameof(CountName));
- }
- }
- }
- 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));
- OnPropertyChanged(nameof(CountName));
- }
- }
- }
- //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));
- OnPropertyChanged(nameof(CountName));
- }
- }
- }
- //public string IndCountName
- //{
- // get
- // {
- // if(MeterType == 1 || MeterType == 2)
- // {
- // return IndCount + "";
- // }
- // return "";
- // }
- //}
- public string CountName
- {
- get
- {
- if(MeterType == 1 )
- {
- return "数字: " + NumCount + " ;指针: " + IndCount;
- }
- else if(MeterType == 2)
- {
- return "指针: " + IndCount;
- }
- else if(MeterType == 3)
- {
- return "数字: " + NumCount;
- }
- else
- {
- return "";
- }
- }
- }
- private string _featureRegion;
- public string FeatureRegion
- {
- get => _featureRegion;
- set
- {
- if(_featureRegion != value)
- {
- _featureRegion = value;
- OnPropertyChanged(nameof(FeatureRegion));
- OnPropertyChanged(nameof(FeatureRegionName));
- }
- }
- }
- public string FeatureRegionName
- {
- get
- {
- if(MeterType == 1 || MeterType == 3 || MeterType == 2)
- {
- return FeatureRegion;
- }
- else
- {
- return "";
- }
- }
- }
- private double _lastUnit;
- public double LastUnit
- {
- get => _lastUnit;
- set
- {
- if(_lastUnit != value)
- {
- _lastUnit = value;
- OnPropertyChanged(nameof(LastUnit));
- OnPropertyChanged(nameof(LastUnitName));
- }
- }
- }
- public string LastUnitName
- {
- get
- {
- if (MeterType == 1 || MeterType == 3 || MeterType == 2)
- {
- return LastUnit + "";
- }
- else
- {
- return "";
- }
- }
- }
- private double _lastValue;
- public double LastValue
- {
- get => _lastValue;
- set
- {
- if(_lastValue != value)
- {
- _lastValue = value;
- OnPropertyChanged(nameof(LastValue));
- OnPropertyChanged(nameof(LastValueName));
- }
- }
- }
- public string LastValueName
- {
- get
- {
- if (string.IsNullOrEmpty(LastTime))
- {
- return "";
- }
- else
- {
- return LastValue + "";
- }
- }
- }
- private string _lastTime;
- public string LastTime
- {
- //get => ThisApp.ConvertDateFormat(_lastTime);
- get => _lastTime;
- set
- {
- if(_lastTime != value)
- {
- _lastTime = value;
- OnPropertyChanged(nameof(LastTime));
- OnPropertyChanged(nameof(LastTimeName));
- OnPropertyChanged(nameof(LastValueName));
- }
- }
- }
- 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 "";
- //return "非水表";
- }
- }
- }
- }
|