NotifiableData.cs 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Linq;
  5. using System.Reflection;
  6. using System.Runtime.Serialization;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Input;
  10. using Aitex.Core.UI.MVVM;
  11. namespace MECF.Framework.Common.CommonData
  12. {
  13. [Serializable]
  14. [DataContract]
  15. public class NotifiableItem : INotifyPropertyChanged
  16. {
  17. public event PropertyChangedEventHandler PropertyChanged;
  18. public void InvokePropertyChanged(string propertyName)
  19. {
  20. if (PropertyChanged != null)
  21. {
  22. PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
  23. }
  24. }
  25. public void InvokePropertyChanged()
  26. {
  27. PropertyInfo[] ps = this.GetType().GetProperties();
  28. foreach (PropertyInfo p in ps)
  29. {
  30. InvokePropertyChanged(p.Name);
  31. if (p.PropertyType == typeof(ICommand))
  32. {
  33. DelegateCommand<string> cmd = p.GetValue(this, null) as DelegateCommand<string>;
  34. if (cmd != null)
  35. cmd.RaiseCanExecuteChanged();
  36. }
  37. }
  38. FieldInfo[] fi = this.GetType().GetFields();
  39. foreach (FieldInfo p in fi)
  40. {
  41. InvokePropertyChanged(p.Name);
  42. if (p.FieldType == typeof(ICommand))
  43. {
  44. DelegateCommand<string> cmd = p.GetValue(this) as DelegateCommand<string>;
  45. if (cmd != null)
  46. cmd.RaiseCanExecuteChanged();
  47. }
  48. }
  49. }
  50. }
  51. [DataContract]
  52. [Serializable]
  53. public class WCFProcessJobInterface
  54. {
  55. [DataMember]
  56. public string ObjtID { get; set; }
  57. [DataMember]
  58. public string ObjType { get; set; }
  59. [DataMember]
  60. public string PRMtlType { get; set; }
  61. [DataMember]
  62. public bool PRProcessStart { get; set; }
  63. [DataMember]
  64. public string PRRecipeMethod { get; set; }
  65. [DataMember]
  66. public string PJstate { get; set; }
  67. [DataMember]
  68. public DateTime CreateTime { get; set; }
  69. [DataMember]
  70. public DateTime CompleteTime { get; set; }
  71. [DataMember]
  72. public string RecID { get; set; }
  73. }
  74. [DataContract]
  75. [Serializable]
  76. public class WCFControlJobInterface
  77. {
  78. [DataMember]
  79. public string ObjtID { get; set; }
  80. [DataMember]
  81. public string ObjType { get; set; }
  82. [DataMember]
  83. public string ProcessingOrderMgmt { get; set; }
  84. [DataMember]
  85. public bool StartMethod { get; set; }
  86. [DataMember]
  87. public string state { get; set; }
  88. [DataMember]
  89. public DateTime CreateTime { get; set; }
  90. [DataMember]
  91. public DateTime CompleteTime { get; set; }
  92. }
  93. }