PeriodicTableVisualSettings.xaml.cs 6.5 KB

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