TSlaveDetail.cs 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. using MV485.helper;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.ComponentModel;
  5. using System.IO;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. namespace MV485.model
  10. {
  11. public class TSlaveDetail : INotifyPropertyChanged
  12. {
  13. public event PropertyChangedEventHandler PropertyChanged;
  14. protected virtual void OnPropertyChanged(string propertyName)
  15. {
  16. PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
  17. }
  18. public string DetailId { get; set; }
  19. public string SlaveId { get; set; }
  20. public string DeviceSn { get; set; }
  21. public string ReadTime { get; set; }
  22. public ulong SampleResult { get; set; }
  23. public string SampleResultName
  24. {
  25. get
  26. {
  27. if(MeterType > 0 && MeterType <= 3)
  28. {
  29. return ((double)SampleResult / Constant.CUBE_VALUE).ToString();
  30. }
  31. return "";
  32. }
  33. }
  34. public string SampleTime { get; set; }
  35. public int MeterType { get; set; }
  36. public string MeterResult
  37. {
  38. get
  39. {
  40. //return MeterType.ToString();
  41. if (!string.IsNullOrEmpty(SampleTime))
  42. {
  43. return Tools.GetResultTypeName((byte)MeterType);
  44. }
  45. else
  46. {
  47. return "";
  48. }
  49. }
  50. }
  51. public string ImageFile { get; set; }
  52. private int _index;
  53. public int Index
  54. {
  55. get => _index;
  56. set
  57. {
  58. if(_index != value)
  59. {
  60. _index = value;
  61. OnPropertyChanged(nameof(Index));
  62. }
  63. }
  64. }
  65. public string ImageSource
  66. {
  67. get
  68. {
  69. if (File.Exists(ImageFile))
  70. {
  71. return ImageFile;
  72. }
  73. else
  74. {
  75. return null;
  76. }
  77. }
  78. }
  79. private string _readMemo;
  80. public string ReadMemo
  81. {
  82. get => _readMemo;
  83. set
  84. {
  85. if(_readMemo != value)
  86. {
  87. _readMemo = value;
  88. OnPropertyChanged(nameof(ReadMemo));
  89. }
  90. }
  91. }
  92. //--------------------------------------------------------------------
  93. }
  94. }