ResultChannelViewModel.cs 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. using IViewModel.ViewModels;
  2. using IViewModel.Tools;
  3. using Shaker.Models;
  4. using Shaker.Tools;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. namespace Dynamicloadsimulationdevice.ViewModels
  11. {
  12. internal sealed class ResultChannelViewModel : ViewModelBase<ResultChannelModel>
  13. {
  14. public ResultChannelViewModel():base()
  15. {
  16. }
  17. public ResultChannelViewModel(ResultChannelModel model):base(model)
  18. {
  19. }
  20. public override void UpDateModel(ResultChannelModel model)
  21. {
  22. base.UpDateModel(model);
  23. Unit = ChannelType.GetUnit();
  24. Name = ChannelType.Description();
  25. }
  26. private string unit=string.Empty;
  27. private string name = string.Empty;
  28. /// <summary>
  29. /// 通道定义
  30. /// </summary>
  31. public Shaker.Model.ResultChannel Channel { get => Model.Channel; set => Model.Channel = value; }
  32. /// <summary>
  33. /// 通道类型
  34. /// </summary>
  35. public Shaker.Model.ResultChannelType ChannelType => Model.ChannelType;
  36. /// <summary>
  37. /// 单位
  38. /// </summary>
  39. public string Unit { get => unit; private set =>SetProperty(ref unit, value); }
  40. /// <summary>
  41. /// 名称
  42. /// </summary>
  43. public string Name { get => name; private set => name = value; }
  44. public override string ToString()
  45. {
  46. return $"{ChannelType} {Channel} {Unit}";
  47. }
  48. }
  49. }