123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386 |
- namespace OINA.Extender.Testharness
- {
- using System;
- using System.Collections.Generic;
- using System.Drawing;
- using System.Linq;
- using System.Reflection;
- using System.Windows.Forms;
- using OINA.Extender.Controls.Styles;
-
- /// <summary>
- /// Interaction logic for DetailDialogVisualSettings
- /// </summary>
- public partial class DetailDialogVisualSettings : Form
- {
- /// <summary>
- /// Gets or sets the color of the dialog background.
- /// </summary>
- /// <value>
- /// The color of the dialog background.
- /// </value>
- public System.Windows.Media.Color DialogBackgroundColor
- {
- get
- {
- return DetailsDialogStyle.DialogBackgroundColor;
- }
- set
- {
- DetailsDialogStyle.DialogBackgroundColor = value;
- this.backgroundColorPanel.BackColor = ColorConverter.Convert(value);
- }
- }
- /// <summary>
- /// Gets or sets the color of the header text.
- /// </summary>
- /// <value>
- /// The color of the header text.
- /// </value>
- public System.Windows.Media.Color HeaderTextColor
- {
- get
- {
- return DetailsDialogStyle.HeaderTextColor;
- }
- set
- {
- DetailsDialogStyle.HeaderTextColor = value;
- this.headerColorPanel.BackColor = ColorConverter.Convert(value);
- }
- }
- /// <summary>
- /// Gets or sets the color of the details text.
- /// </summary>
- /// <value>
- /// The color of the details text.
- /// </value>
- public System.Windows.Media.Color DetailsTextColor
- {
- get
- {
- return DetailsDialogStyle.DetailsTextColor;
- }
- set
- {
- DetailsDialogStyle.DetailsTextColor = value;
- this.detailColorPanel.BackColor = ColorConverter.Convert(value);
- }
- }
- /// <summary>
- /// Gets or sets the header text font family.
- /// </summary>
- /// <value>
- /// The header text font family.
- /// </value>
- public System.Windows.Media.FontFamily HeaderTextFontFamily
- {
- get
- {
- return DetailsDialogStyle.HeaderTextFontFamily;
- }
- set
- {
- DetailsDialogStyle.HeaderTextFontFamily = value;
- }
- }
- /// <summary>
- /// Gets or sets the header text font style.
- /// </summary>
- /// <value>
- /// The header text font style.
- /// </value>
- public System.Windows.FontStyle HeaderTextFontStyle
- {
- get
- {
- return DetailsDialogStyle.HeaderTextFontStyle;
- }
- set
- {
- DetailsDialogStyle.HeaderTextFontStyle = value;
- }
- }
- /// <summary>
- /// Gets or sets the size of the header text.
- /// </summary>
- /// <value>
- /// The size of the header text.
- /// </value>
- public double HeaderTextSize
- {
- get
- {
- return DetailsDialogStyle.HeaderTextSize;
- }
- set
- {
- DetailsDialogStyle.HeaderTextSize = value;
- }
- }
- /// <summary>
- /// Gets or sets the details text font family.
- /// </summary>
- /// <value>
- /// The details text font family.
- /// </value>
- public System.Windows.Media.FontFamily DetailsTextFontFamily
- {
- get
- {
- return DetailsDialogStyle.DetailsTextFontFamily;
- }
- set
- {
- DetailsDialogStyle.DetailsTextFontFamily = value;
- }
- }
- /// <summary>
- /// Gets or sets the details text font style.
- /// </summary>
- /// <value>
- /// The details text font style.
- /// </value>
- public System.Windows.FontStyle DetailsTextFontStyle
- {
- get
- {
- return DetailsDialogStyle.DetailsTextFontStyle;
- }
- set
- {
- DetailsDialogStyle.DetailsTextFontStyle = value;
- }
- }
- /// <summary>
- /// Gets or sets the size of the details text.
- /// </summary>
- /// <value>
- /// The size of the details text.
- /// </value>
- public double DetailsTextSize
- {
- get
- {
- return DetailsDialogStyle.DetailsTextSize;
- }
- set
- {
- DetailsDialogStyle.DetailsTextSize = value;
- }
- }
- /// <summary>
- /// The are combos binding
- /// </summary>
- private bool areCombosBinding;
- /// <summary>
- /// Initializes a new instance of the <see cref="DetailDialogVisualSettings"/> class.
- /// </summary>
- public DetailDialogVisualSettings()
- {
- this.areCombosBinding = true;
- this.InitializeComponent();
- this.backgroundColorComboBox.DataSource = typeof(System.Windows.Media.Colors).GetProperties();
- this.backgroundColorComboBox.DisplayMember = @"Name";
- this.headerColorComboBox.DataSource = typeof(System.Windows.Media.Colors).GetProperties();
- this.headerColorComboBox.DisplayMember = @"Name";
- this.detailColorComboBox.DataSource = typeof(System.Windows.Media.Colors).GetProperties();
- this.detailColorComboBox.DisplayMember = @"Name";
- this.headerFontFamilyComboBox.DataSource = System.Windows.Media.Fonts.SystemFontFamilies.ToList();
- this.headerFontStyleComboBox.DataSource = new System.Windows.FontStyle[]
- {
- System.Windows.FontStyles.Normal,
- System.Windows.FontStyles.Italic,
- System.Windows.FontStyles.Oblique
- };
- this.detailFontFamilyComboBox.DataSource = System.Windows.Media.Fonts.SystemFontFamilies.ToList();
- this.detailFontStyleComboBox.DataSource = new System.Windows.FontStyle[]
- {
- System.Windows.FontStyles.Normal,
- System.Windows.FontStyles.Italic,
- System.Windows.FontStyles.Oblique
- };
- this.areCombosBinding = false;
- this.UpdateUI();
- }
- /// <summary>
- /// Handles the SelectedValueChanged event of the ComboBox control.
- /// </summary>
- /// <param name="sender">The source of the event.</param>
- /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
- private void ComboBox_SelectedValueChanged(object sender, EventArgs e)
- {
- ComboBox combo = sender as ComboBox;
- if (this.areCombosBinding || combo == null)
- {
- return;
- }
- if (combo.Name.Contains(@"header"))
- {
- this.HeaderTextFontFamily = (System.Windows.Media.FontFamily)this.headerFontFamilyComboBox.SelectedItem;
- if (combo.Name.Contains(@"Style")
- && this.headerFontStyleComboBox.SelectedIndex != -1
- && ((System.Windows.FontStyle)this.headerFontStyleComboBox.SelectedItem) != this.HeaderTextFontStyle)
- {
- this.HeaderTextFontStyle = (System.Windows.FontStyle)this.headerFontStyleComboBox.SelectedItem;
- }
- }
- else if (combo.Name.Contains(@"detail"))
- {
- this.DetailsTextFontFamily = (System.Windows.Media.FontFamily)this.detailFontFamilyComboBox.SelectedItem;
- if (combo.Name.Contains(@"Style")
- && this.detailFontStyleComboBox.SelectedIndex != -1
- && ((System.Windows.FontStyle)this.detailFontStyleComboBox.SelectedItem) != this.DetailsTextFontStyle)
- {
- this.DetailsTextFontStyle = (System.Windows.FontStyle)this.detailFontStyleComboBox.SelectedItem;
- }
- }
- }
- /// <summary>
- /// Updates the UI.
- /// </summary>
- private void UpdateUI()
- {
- this.headerFontFamilyComboBox.SelectedItem = this.HeaderTextFontFamily;
- this.detailFontFamilyComboBox.SelectedItem = this.DetailsTextFontFamily;
- this.headerFontStyleComboBox.SelectedItem = this.HeaderTextFontStyle;
- this.detailFontStyleComboBox.SelectedItem = this.DetailsTextFontStyle;
- PropertyInfo[] info = typeof(System.Windows.Media.Colors).GetProperties();
- this.backgroundColorComboBox.SelectedItem = info.FirstOrDefault(p => ((System.Windows.Media.Color)p.GetValue(null, null)) == this.DialogBackgroundColor);
- this.headerColorComboBox.SelectedItem = info.FirstOrDefault(p => ((System.Windows.Media.Color)p.GetValue(null, null)) == this.HeaderTextColor);
- this.detailColorComboBox.SelectedItem = info.FirstOrDefault(p => ((System.Windows.Media.Color)p.GetValue(null, null)) == this.DetailsTextColor);
- this.backgroundColorPanel.BackColor = ColorConverter.Convert(this.DialogBackgroundColor);
- this.headerColorPanel.BackColor = ColorConverter.Convert(this.HeaderTextColor);
- this.detailColorPanel.BackColor = ColorConverter.Convert(this.DetailsTextColor);
- this.headerSizeNumericUpDown.Value = (int)this.HeaderTextSize;
- this.detailSizeNumericUpDown.Value = (int)this.DetailsTextSize;
- }
- /// <summary>
- /// Called when [reset styles button click].
- /// </summary>
- /// <param name="sender">The sender.</param>
- /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
- private void OnResetStylesButtonClick(object sender, EventArgs e)
- {
- DetailsDialogStyle.ResetStyles();
- this.UpdateUI();
- }
- /// <summary>
- /// Handles the SelectedValueChanged event of the backgroundColorComboBox control.
- /// </summary>
- /// <param name="sender">The source of the event.</param>
- /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
- private void OnBackgroundColorComboBoxSelectedValueChanged(object sender, EventArgs e)
- {
- if (this.areCombosBinding || this.backgroundColorComboBox.SelectedIndex == -1)
- {
- return;
- }
- PropertyInfo info = this.backgroundColorComboBox.SelectedItem as PropertyInfo;
- System.Windows.Media.Color selectedColor = info != null ? (System.Windows.Media.Color)info.GetValue(null, null) : new System.Windows.Media.Color();
- this.backgroundColorPanel.BackColor = ColorConverter.Convert(selectedColor);
- this.DialogBackgroundColor = selectedColor;
- }
- /// <summary>
- /// Handles the SelectedValueChanged event of the headerColorComboBox control.
- /// </summary>
- /// <param name="sender">The source of the event.</param>
- /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
- private void OnHeaderColorComboBoxSelectedValueChanged(object sender, EventArgs e)
- {
- if (this.areCombosBinding || this.headerColorComboBox.SelectedIndex == -1)
- {
- return;
- }
- PropertyInfo info = this.headerColorComboBox.SelectedItem as PropertyInfo;
- System.Windows.Media.Color selectedColor = info != null ? (System.Windows.Media.Color)info.GetValue(null, null) : new System.Windows.Media.Color();
- this.headerColorPanel.BackColor = ColorConverter.Convert(selectedColor);
- this.HeaderTextColor = selectedColor;
- }
- /// <summary>
- /// Handles the SelectedValueChanged event of the detailColorComboBox control.
- /// </summary>
- /// <param name="sender">The source of the event.</param>
- /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
- private void OnDetailColorComboBoxSelectedValueChanged(object sender, EventArgs e)
- {
- if (this.areCombosBinding || this.detailColorComboBox.SelectedIndex == -1)
- {
- return;
- }
- PropertyInfo info = this.detailColorComboBox.SelectedItem as PropertyInfo;
- System.Windows.Media.Color selectedColor = info != null ? (System.Windows.Media.Color)info.GetValue(null, null) : new System.Windows.Media.Color();
- this.detailColorPanel.BackColor = ColorConverter.Convert(selectedColor);
- this.DetailsTextColor = selectedColor;
- }
- /// <summary>
- /// Handles the ValueChanged event of the headerSizeNumericUpDown control.
- /// </summary>
- /// <param name="sender">The source of the event.</param>
- /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
- private void OnHeaderSizeNumericUpDownValueChanged(object sender, EventArgs e)
- {
- this.HeaderTextSize = (double)this.headerSizeNumericUpDown.Value;
- }
- /// <summary>
- /// Handles the ValueChanged event of the detailSizeNumericUpDown control.
- /// </summary>
- /// <param name="sender">The source of the event.</param>
- /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
- private void OnDetailSizeNumericUpDownValueChanged(object sender, EventArgs e)
- {
- this.DetailsTextSize = (double)this.detailSizeNumericUpDown.Value;
- }
- }
- }
|