123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149 |
- namespace OINA.Extender.Testharness
- {
- using System.Globalization;
- using System.Windows.Forms;
- /// <summary>
- /// BeamMeasurementSettings Form.
- /// </summary>
- public partial class BeamMeasurementSettings : Form
- {
- /// <summary>
- /// Last selected process time
- /// </summary>
- private int processTime;
- /// <summary>
- /// Last selected Energy Range
- /// </summary>
- private int energyRange;
- /// <summary>
- /// Last selected number of channels
- /// </summary>
- private int numberOfChannels;
- /// <summary>
- /// BeamMeasurementSettings Constructor.
- /// </summary>
- public BeamMeasurementSettings()
- {
- this.InitializeComponent();
- this.SaveLastSettings();
- this.SetComboBoxDataSource();
- this.ReadLastSettings();
- }
- /// <summary>
- /// Read Last Settings
- /// </summary>
- private void ReadLastSettings()
- {
- this.ProcesstimeCombobox.SelectedItem = this.processTime;
- this.EnergyRangeCombobox.SelectedItem = this.energyRange;
- this.NumberofchannelsCombobox.SelectedItem = this.numberOfChannels;
- this.TotalcountsTextbox.Text = OIHelper.QuantCalibrationSettings.TotalCountsInSpectrum.ToString(CultureInfo.InvariantCulture);
- }
- /// <summary>
- /// Save Last Settings
- /// </summary>
- private void SaveLastSettings()
- {
- this.processTime = OIHelper.QuantCalibrationSettings.EdSettings.ProcessTime;
- this.energyRange = OIHelper.QuantCalibrationSettings.EdSettings.EnergyRange;
- this.numberOfChannels = OIHelper.QuantCalibrationSettings.EdSettings.NumberOfChannels;
- }
- /// <summary>
- /// Set ComboBox DataSource
- /// </summary>
- private void SetComboBoxDataSource()
- {
- this.EnergyRangeCombobox.DataSource = OIHelper.EdSpectrumSettings.EdCapabilities.AllowedEnergyRanges;
- this.NumberofchannelsCombobox.DataSource = OIHelper.EdSpectrumSettings.EdCapabilities.AllowedNumberOfChannels;
- this.ProcesstimeCombobox.DataSource = OIHelper.EdSpectrumSettings.EdCapabilities.AllowedProcessTimes;
- }
- /// <summary>
- /// EnergyRangeCombobox_SelectedIndexChanged event handler
- /// </summary>
- /// <param name="sender">sender</param>
- /// <param name="e">EventArgs</param>
- private void EnergyRangeCombobox_SelectedValueChanged(object sender, System.EventArgs e)
- {
- if (this.EnergyRangeCombobox.SelectedValue != null)
- {
- OIHelper.QuantCalibrationSettings.EdSettings.EnergyRange = (int)this.EnergyRangeCombobox.SelectedValue;
- }
- }
- /// <summary>
- /// NumberofchannelsCombobox_SelectedIndexChanged event handler
- /// </summary>
- /// <param name="sender">sender</param>
- /// <param name="e">EventArgs</param>
- private void NumberofchannelsCombobox_SelectedValueChanged(object sender, System.EventArgs e)
- {
- if (this.NumberofchannelsCombobox.SelectedValue != null)
- {
- OIHelper.QuantCalibrationSettings.EdSettings.NumberOfChannels = (int)this.NumberofchannelsCombobox.SelectedValue;
- }
- }
- /// <summary>
- /// ProcesstimeCombobox_SelectedIndexChanged event handler
- /// </summary>
- /// <param name="sender">sender</param>
- /// <param name="e">EventArgs</param>
- private void ProcesstimeCombobox_SelectedValueChanged(object sender, System.EventArgs e)
- {
- if (this.ProcesstimeCombobox.SelectedValue != null)
- {
- OIHelper.QuantCalibrationSettings.EdSettings.ProcessTime = (int)this.ProcesstimeCombobox.SelectedValue;
- }
- }
- /// <summary>
- /// TotalcountsTextbox_TextChanged event handler
- /// </summary>
- /// <param name="sender">sender</param>
- /// <param name="e">e</param>
- private void TotalcountsTextbox_TextChanged(object sender, System.EventArgs e)
- {
- int totalCounts;
- if (int.TryParse(this.TotalcountsTextbox.Text, out totalCounts))
- {
- OIHelper.QuantCalibrationSettings.TotalCountsInSpectrum = totalCounts;
- }
- }
- /// <summary>
- /// Form closing event
- /// </summary>
- /// <param name="sender">sender</param>
- /// <param name="e">e</param>
- private void OnFormClosing(object sender, FormClosingEventArgs e)
- {
- OIHelper.QuantCalibrationSettings.EdSettings.ProcessTime = (int)this.ProcesstimeCombobox.SelectedValue;
- OIHelper.QuantCalibrationSettings.EdSettings.NumberOfChannels = (int)this.NumberofchannelsCombobox.SelectedValue;
- OIHelper.QuantCalibrationSettings.EdSettings.EnergyRange = (int)this.EnergyRangeCombobox.SelectedValue;
- }
- /// <summary>
- /// OKButton_Click
- /// </summary>
- /// <param name="sender">sender</param>
- /// <param name="e">e</param>
- private void OKButton_Click(object sender, System.EventArgs e)
- {
- this.Close();
- }
- }
- }
|