IOSimulatorItemViewModel.cs 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. using Aitex.Core.UI.MVVM;
  2. using Newtonsoft.Json;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. namespace MECF.Framework.Simulator.Core.Commons
  9. {
  10. public class IOSimulatorItemViewModel: ViewModelBase
  11. {
  12. public string SourceCommandName { get; set; }//key
  13. public string SourceCommand { get; set; }
  14. public string SourceCommandType { get; set; }
  15. private string _commandContent;
  16. public string CommandContent
  17. {
  18. get { return _commandContent; }
  19. set
  20. {
  21. _commandContent = value;
  22. InvokePropertyChanged("CommandContent");
  23. }
  24. }
  25. private DateTime _commandRecievedTime;
  26. public DateTime CommandRecievedTime
  27. {
  28. get { return _commandRecievedTime; }
  29. set
  30. {
  31. _commandRecievedTime = value;
  32. InvokePropertyChanged("CommandRecievedTime");
  33. }
  34. }
  35. private string _response;
  36. public string Response
  37. {
  38. get { return _response; }
  39. set
  40. {
  41. _response = value;
  42. InvokePropertyChanged("Response");
  43. }
  44. }
  45. public string SuccessResponseStr
  46. {
  47. get
  48. {
  49. if(SuccessResponse != null)
  50. {
  51. var sResponse = SuccessResponse.ToString();
  52. if (sResponse.Contains('{'))
  53. {
  54. return JsonConvert.SerializeObject(SuccessResponse);
  55. }
  56. else
  57. {
  58. return sResponse;
  59. }
  60. }
  61. return null;
  62. }
  63. }
  64. public string FailedResponseStr
  65. {
  66. get
  67. {
  68. if(FailedResponse != null)
  69. {
  70. var sResponse = FailedResponse.ToString();
  71. if (sResponse.Contains('{'))
  72. {
  73. return JsonConvert.SerializeObject(FailedResponse);
  74. }
  75. else
  76. {
  77. return sResponse;
  78. }
  79. }
  80. return null;
  81. }
  82. }
  83. public object SuccessResponse { get; set; }//value, as default response
  84. public object FailedResponse { get; set; }//value, as default response
  85. //public int AutoReplyTimeout { get; set; }
  86. private bool _isManualReplyEnable;
  87. public bool IsManualReplyEnable
  88. {
  89. get { return _isManualReplyEnable; }
  90. set {
  91. _isManualReplyEnable = value;
  92. InvokePropertyChanged("IsManualReplyEnable");
  93. }
  94. }
  95. }
  96. public class IOSimulatorItemViewModelConfig
  97. {
  98. public List<IOSimulatorItemViewModel> IOSimulatorItemList { get; set; }
  99. }
  100. }