OrgChartEntry.cs 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. using System;
  2. using System.ComponentModel;
  3. using System.Windows;
  4. using System.Windows.Media;
  5. namespace PRSDesktop
  6. {
  7. public class OrgChartEntry : INotifyPropertyChanged
  8. {
  9. private string _background = "#00000000";
  10. private string _color = "#00000000";
  11. private Guid _id = Guid.Empty;
  12. private ImageBrush _image = new();
  13. private Guid _imageid = Guid.Empty;
  14. private string _name;
  15. private Guid _parentid = Guid.Empty;
  16. private string _position;
  17. private bool _visible;
  18. public Guid ID
  19. {
  20. get => _id;
  21. set
  22. {
  23. if (_id != value)
  24. {
  25. _id = value;
  26. OnPropertyChanged("ID");
  27. }
  28. }
  29. }
  30. public Guid ParentID
  31. {
  32. get => _parentid;
  33. set
  34. {
  35. if (_parentid != value)
  36. {
  37. _parentid = value;
  38. OnPropertyChanged("ParentID");
  39. }
  40. }
  41. }
  42. public string Position
  43. {
  44. get => _position;
  45. set
  46. {
  47. if (_position != value)
  48. {
  49. _position = value;
  50. OnPropertyChanged("Position");
  51. }
  52. }
  53. }
  54. public string Name
  55. {
  56. get => _name;
  57. set
  58. {
  59. if (_name != value)
  60. {
  61. _name = value;
  62. OnPropertyChanged("Name");
  63. }
  64. }
  65. }
  66. public Guid ImageID
  67. {
  68. get => _imageid;
  69. set
  70. {
  71. if (_imageid != value)
  72. {
  73. _imageid = value;
  74. OnPropertyChanged("ImageID");
  75. }
  76. }
  77. }
  78. public ImageBrush Image
  79. {
  80. get => _image;
  81. set
  82. {
  83. if (_image != value)
  84. if (value != null)
  85. {
  86. _image = value;
  87. OnPropertyChanged("Image");
  88. }
  89. }
  90. }
  91. public Visibility ImageVisible => _imageid != Guid.Empty ? Visibility.Visible : Visibility.Collapsed;
  92. public string Color
  93. {
  94. get => _color;
  95. set
  96. {
  97. if (_color != value)
  98. if (value != null)
  99. {
  100. _color = value;
  101. OnPropertyChanged("Color");
  102. }
  103. }
  104. }
  105. public bool Visible
  106. {
  107. get => _visible;
  108. set
  109. {
  110. if (_visible != value)
  111. {
  112. _visible = value;
  113. OnPropertyChanged("Visible");
  114. }
  115. }
  116. }
  117. public string WarningColor
  118. {
  119. get => _background;
  120. set
  121. {
  122. if (_background != value)
  123. if (value != null)
  124. {
  125. _background = value;
  126. OnPropertyChanged("WarningColor");
  127. }
  128. }
  129. }
  130. public event PropertyChangedEventHandler PropertyChanged;
  131. private void OnPropertyChanged(string name)
  132. {
  133. if (PropertyChanged != null) PropertyChanged.Invoke(this, new PropertyChangedEventArgs(name));
  134. }
  135. }
  136. }