DetailDialogVisualSettings.xaml.cs 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  1. namespace OINA.Extender.WPF.Testharness
  2. {
  3. using System.ComponentModel;
  4. using System.Windows;
  5. using System.Windows.Controls;
  6. using System.Windows.Data;
  7. using System.Windows.Media;
  8. using OINA.Extender.Controls.Styles;
  9. /// <summary>
  10. /// Interaction logic for DetailDialogVisualSettings.xaml
  11. /// </summary>
  12. public partial class DetailDialogVisualSettings : Window, INotifyPropertyChanged
  13. {
  14. /// <summary>
  15. /// Gets or sets the color of the dialog background.
  16. /// </summary>
  17. /// <value>
  18. /// The color of the dialog background.
  19. /// </value>
  20. public Color DialogBackgroundColor
  21. {
  22. get
  23. {
  24. return DetailsDialogStyle.DialogBackgroundColor;
  25. }
  26. set
  27. {
  28. if (DetailsDialogStyle.DialogBackgroundColor != value)
  29. {
  30. DetailsDialogStyle.DialogBackgroundColor = value;
  31. this.RaisePropertyChanged(nameof(this.DialogBackgroundColor));
  32. }
  33. }
  34. }
  35. /// <summary>
  36. /// Gets or sets the color of the header text.
  37. /// </summary>
  38. /// <value>
  39. /// The color of the header text.
  40. /// </value>
  41. public Color HeaderTextColor
  42. {
  43. get
  44. {
  45. return DetailsDialogStyle.HeaderTextColor;
  46. }
  47. set
  48. {
  49. if (DetailsDialogStyle.HeaderTextColor != value)
  50. {
  51. DetailsDialogStyle.HeaderTextColor = value;
  52. this.RaisePropertyChanged(nameof(this.HeaderTextColor));
  53. }
  54. }
  55. }
  56. /// <summary>
  57. /// Gets or sets the color of the details text.
  58. /// </summary>
  59. /// <value>
  60. /// The color of the details text.
  61. /// </value>
  62. public Color DetailsTextColor
  63. {
  64. get
  65. {
  66. return DetailsDialogStyle.DetailsTextColor;
  67. }
  68. set
  69. {
  70. if (DetailsDialogStyle.DetailsTextColor != value)
  71. {
  72. DetailsDialogStyle.DetailsTextColor = value;
  73. this.RaisePropertyChanged(nameof(this.DetailsTextColor));
  74. }
  75. }
  76. }
  77. /// <summary>
  78. /// Gets or sets the header text font family.
  79. /// </summary>
  80. /// <value>
  81. /// The header text font family.
  82. /// </value>
  83. public FontFamily HeaderTextFontFamily
  84. {
  85. get
  86. {
  87. return DetailsDialogStyle.HeaderTextFontFamily;
  88. }
  89. set
  90. {
  91. if (DetailsDialogStyle.HeaderTextFontFamily != value)
  92. {
  93. DetailsDialogStyle.HeaderTextFontFamily = value;
  94. this.RaisePropertyChanged(nameof(this.HeaderTextFontFamily));
  95. }
  96. }
  97. }
  98. /// <summary>
  99. /// Gets or sets the header text font style.
  100. /// </summary>
  101. /// <value>
  102. /// The header text font style.
  103. /// </value>
  104. public FontStyle HeaderTextFontStyle
  105. {
  106. get
  107. {
  108. return DetailsDialogStyle.HeaderTextFontStyle;
  109. }
  110. set
  111. {
  112. if (DetailsDialogStyle.HeaderTextFontStyle != value)
  113. {
  114. DetailsDialogStyle.HeaderTextFontStyle = value;
  115. this.RaisePropertyChanged(nameof(this.HeaderTextFontStyle));
  116. }
  117. }
  118. }
  119. /// <summary>
  120. /// Gets or sets the size of the header text.
  121. /// </summary>
  122. /// <value>
  123. /// The size of the header text.
  124. /// </value>
  125. public double HeaderTextSize
  126. {
  127. get
  128. {
  129. return DetailsDialogStyle.HeaderTextSize;
  130. }
  131. set
  132. {
  133. if (DetailsDialogStyle.HeaderTextSize != value)
  134. {
  135. DetailsDialogStyle.HeaderTextSize = value;
  136. this.RaisePropertyChanged(nameof(this.HeaderTextSize));
  137. }
  138. }
  139. }
  140. /// <summary>
  141. /// Gets or sets the details text font family.
  142. /// </summary>
  143. /// <value>
  144. /// The details text font family.
  145. /// </value>
  146. public FontFamily DetailsTextFontFamily
  147. {
  148. get
  149. {
  150. return DetailsDialogStyle.DetailsTextFontFamily;
  151. }
  152. set
  153. {
  154. if (DetailsDialogStyle.DetailsTextFontFamily != value)
  155. {
  156. DetailsDialogStyle.DetailsTextFontFamily = value;
  157. this.RaisePropertyChanged(nameof(this.DetailsTextFontFamily));
  158. }
  159. }
  160. }
  161. /// <summary>
  162. /// Gets or sets the details text font style.
  163. /// </summary>
  164. /// <value>
  165. /// The details text font style.
  166. /// </value>
  167. public FontStyle DetailsTextFontStyle
  168. {
  169. get
  170. {
  171. return DetailsDialogStyle.DetailsTextFontStyle;
  172. }
  173. set
  174. {
  175. if (DetailsDialogStyle.DetailsTextFontStyle != value)
  176. {
  177. DetailsDialogStyle.DetailsTextFontStyle = value;
  178. this.RaisePropertyChanged(nameof(this.DetailsTextFontStyle));
  179. }
  180. }
  181. }
  182. /// <summary>
  183. /// Gets or sets the size of the details text.
  184. /// </summary>
  185. /// <value>
  186. /// The size of the details text.
  187. /// </value>
  188. public double DetailsTextSize
  189. {
  190. get
  191. {
  192. return DetailsDialogStyle.DetailsTextSize;
  193. }
  194. set
  195. {
  196. if (DetailsDialogStyle.DetailsTextSize != value)
  197. {
  198. DetailsDialogStyle.DetailsTextSize = value;
  199. this.RaisePropertyChanged(nameof(this.DetailsTextSize));
  200. }
  201. }
  202. }
  203. /// <summary>
  204. /// Initializes a new instance of the <see cref="DetailDialogVisualSettings"/> class.
  205. /// </summary>
  206. public DetailDialogVisualSettings()
  207. {
  208. this.InitializeComponent();
  209. }
  210. /// <summary>
  211. /// Resets the specified sender.
  212. /// </summary>
  213. /// <param name="sender">The sender.</param>
  214. /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param>
  215. private void Reset(object sender, RoutedEventArgs e)
  216. {
  217. DetailsDialogStyle.ResetStyles();
  218. this.RaisePropertyChanged(nameof(this.DialogBackgroundColor));
  219. this.RaisePropertyChanged(nameof(this.HeaderTextColor));
  220. this.RaisePropertyChanged(nameof(this.DetailsTextColor));
  221. this.RaisePropertyChanged(nameof(this.HeaderTextFontFamily));
  222. this.RaisePropertyChanged(nameof(this.HeaderTextFontStyle));
  223. this.RaisePropertyChanged(nameof(this.HeaderTextSize));
  224. this.RaisePropertyChanged(nameof(this.DetailsTextFontFamily));
  225. this.RaisePropertyChanged(nameof(this.DetailsTextFontStyle));
  226. this.RaisePropertyChanged(nameof(this.DetailsTextSize));
  227. }
  228. /// <summary>
  229. /// Occurs when a property value changes.
  230. /// </summary>
  231. public event PropertyChangedEventHandler PropertyChanged;
  232. /// <summary>
  233. /// Raises the property changed event.
  234. /// </summary>
  235. /// <param name="propertyName">Name of the property.</param>
  236. private void RaisePropertyChanged(string propertyName)
  237. {
  238. var handler = this.PropertyChanged;
  239. if (handler != null)
  240. {
  241. handler(this, new PropertyChangedEventArgs(propertyName));
  242. }
  243. }
  244. }
  245. }