PeriodicTableVisualSettings.xaml.cs 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. #pragma warning disable CA1822
  2. namespace OINA.Extender.WPF.Testharness
  3. {
  4. using System.Windows;
  5. using System.Windows.Media;
  6. using OINA.Extender.Controls.Styles;
  7. /// <summary>
  8. /// Interaction logic for PeriodicTableVisualSettings.xaml
  9. /// </summary>
  10. public partial class PeriodicTableVisualSettings : Window
  11. {
  12. /// <summary>
  13. /// Gets or sets the color of the background.
  14. /// </summary>
  15. /// <value>
  16. /// The color of the background.
  17. /// </value>
  18. public Color BackgroundColor
  19. {
  20. get { return PeriodicTableStyle.BackgroundColor; }
  21. set { PeriodicTableStyle.BackgroundColor = value; }
  22. }
  23. /// <summary>
  24. /// Gets or sets the color of the included element.
  25. /// </summary>
  26. /// <value>
  27. /// The color of the included element.
  28. /// </value>
  29. public Color IncludedElementColor
  30. {
  31. get { return PeriodicTableStyle.ElementIncludeBackgroundColor; }
  32. set { PeriodicTableStyle.ElementIncludeBackgroundColor = value; }
  33. }
  34. /// <summary>
  35. /// Gets or sets the color of the excluded element.
  36. /// </summary>
  37. /// <value>
  38. /// The color of the excluded element.
  39. /// </value>
  40. public Color ExcludedElementColor
  41. {
  42. get { return PeriodicTableStyle.ElementExcludeBackgroundColor; }
  43. set { PeriodicTableStyle.ElementExcludeBackgroundColor = value; }
  44. }
  45. /// <summary>
  46. /// Gets or sets the color of the idle element.
  47. /// </summary>
  48. /// <value>
  49. /// The color of the idle element.
  50. /// </value>
  51. public Color IdleElementColor
  52. {
  53. get
  54. {
  55. return PeriodicTableStyle.ElementIdleBackgroundColor;
  56. }
  57. set
  58. {
  59. PeriodicTableStyle.ElementIdleBackgroundColor = value;
  60. }
  61. }
  62. /// <summary>
  63. /// Gets or sets the color of the element highlight.
  64. /// </summary>
  65. /// <value>
  66. /// The color of the element highlight.
  67. /// </value>
  68. public Color ElementHighlightColor
  69. {
  70. get
  71. {
  72. return PeriodicTableStyle.ElementHighlightColor;
  73. }
  74. set
  75. {
  76. PeriodicTableStyle.ElementHighlightColor = value;
  77. }
  78. }
  79. /// <summary>
  80. /// Gets or sets the color of the element border.
  81. /// </summary>
  82. /// <value>
  83. /// The color of the element border.
  84. /// </value>
  85. public Color ElementBorderColor
  86. {
  87. get
  88. {
  89. return PeriodicTableStyle.ElementBorderColor;
  90. }
  91. set
  92. {
  93. PeriodicTableStyle.ElementBorderColor = value;
  94. }
  95. }
  96. /// <summary>
  97. /// Gets or sets the periodic table font family.
  98. /// </summary>
  99. /// <value>
  100. /// The periodic table font family.
  101. /// </value>
  102. public FontFamily PeriodicTableFontFamily
  103. {
  104. get
  105. {
  106. return PeriodicTableStyle.PeriodicTableFontFamily;
  107. }
  108. set
  109. {
  110. PeriodicTableStyle.PeriodicTableFontFamily = value;
  111. }
  112. }
  113. /// <summary>
  114. /// Gets or sets the periodic table font style.
  115. /// </summary>
  116. /// <value>
  117. /// The periodic table font style.
  118. /// </value>
  119. public FontStyle PeriodicTableFontStyle
  120. {
  121. get
  122. {
  123. return PeriodicTableStyle.PeriodicTableFontStyle;
  124. }
  125. set
  126. {
  127. PeriodicTableStyle.PeriodicTableFontStyle = value;
  128. }
  129. }
  130. /// <summary>
  131. /// Gets or sets the size of the periodic table font.
  132. /// </summary>
  133. /// <value>
  134. /// The size of the periodic table font.
  135. /// </value>
  136. public double PeriodicTableFontSize
  137. {
  138. get
  139. {
  140. return PeriodicTableStyle.PeriodicTableFontSize;
  141. }
  142. set
  143. {
  144. PeriodicTableStyle.PeriodicTableFontSize = value;
  145. }
  146. }
  147. /// <summary>
  148. /// Gets or sets the color of the element font.
  149. /// </summary>
  150. /// <value>
  151. /// The color of the element font.
  152. /// </value>
  153. public Color ElementFontColor
  154. {
  155. get
  156. {
  157. return PeriodicTableStyle.ElementFontColor;
  158. }
  159. set
  160. {
  161. PeriodicTableStyle.ElementFontColor = value;
  162. }
  163. }
  164. /// <summary>
  165. /// Initializes a new instance of the <see cref="PeriodicTableVisualSettings"/> class.
  166. /// </summary>
  167. public PeriodicTableVisualSettings()
  168. {
  169. this.InitializeComponent();
  170. this.DataContext = this;
  171. this.UpdateCombos();
  172. }
  173. /// <summary>
  174. /// Handles the Click event of the ResetStylesButton control.
  175. /// </summary>
  176. /// <param name="sender">The source of the event.</param>
  177. /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param>
  178. private void ResetStylesButton_Click(object sender, RoutedEventArgs e)
  179. {
  180. PeriodicTableStyle.ResetStyles();
  181. this.UpdateCombos();
  182. }
  183. /// <summary>
  184. /// Sets the combo boxes to have the values from the dictionary
  185. /// </summary>
  186. private void UpdateCombos()
  187. {
  188. this.BackgroundColorCombo.SelectedColor = this.BackgroundColor;
  189. this.IncludedElementColorCombo.SelectedColor = this.IncludedElementColor;
  190. this.ExcludedElementColorCombo.SelectedColor = this.ExcludedElementColor;
  191. this.IdleElementColorCombo.SelectedColor = this.IdleElementColor;
  192. this.ElementBorderColorCombo.SelectedColor = this.ElementBorderColor;
  193. this.ElementHighlightColorCombo.SelectedColor = this.ElementHighlightColor;
  194. this.PeriodicTableFontFamilyCombo.SelectedValue = this.PeriodicTableFontFamily;
  195. this.PeriodicTableFontStyleCombo.SelectedValue = this.PeriodicTableFontStyle;
  196. this.PeriodicTableFontSizeCombo.SelectedValue = this.PeriodicTableFontSize;
  197. this.ElementFontColorCombo.SelectedColor = this.ElementFontColor;
  198. }
  199. }
  200. }