using System; using System.Windows.Forms; using CRVM.Entity; namespace CRVM { public partial class GraCheckedTime : UserControl//20151102 jxp { //public delegate void ContentHandler(object sender, EventArgs e); //public event ContentHandler ContentChanged; public GraCheckedTime() { InitializeComponent(); } private void ContentSingleDetail_Load(object sender, EventArgs e) { checkBox_X10.Checked = SysParam.Instance.checkBoxTime; CheckBox_all.Enabled = SysParam.Instance.checkBoxTime; CheckBox_l.Enabled = SysParam.Instance.checkBoxTime; CheckBox_m.Enabled = SysParam.Instance.checkBoxTime; CheckBox_h.Enabled = SysParam.Instance.checkBoxTime; CheckBox_f.Enabled = SysParam.Instance.checkBoxTime; CheckBox_Orig_dt.Enabled = SysParam.Instance.checkBoxTime; CheckBox_all.Checked = SysParam.Instance.checkBoxTimeAll; ComboBoxE_all.Enabled = CheckBox_all.Checked; CheckBox_l.Checked = SysParam.Instance.checkBoxTimeL; ComboBoxE_l.Enabled = CheckBox_l.Checked; CheckBox_m.Checked = SysParam.Instance.checkBoxTimeM; ComboBoxE_m.Enabled = CheckBox_m.Checked; CheckBox_h.Checked = SysParam.Instance.checkBoxTimeH; ComboBoxE_h.Enabled = CheckBox_h.Checked; CheckBox_f.Checked = SysParam.Instance.checkBoxTimeFre; ComboBoxE_f.Enabled = CheckBox_f.Checked; CheckBox_Orig_dt.Checked = SysParam.Instance.checkBoxTimeFilt; ComboBox_Orig_dt.Enabled = CheckBox_Orig_dt.Checked; textBox1.Enabled = CheckBox_Orig_dt.Checked; textBox2.Enabled = CheckBox_Orig_dt.Checked; ComboBoxE_all.Text = SysParam.Instance.comboBoxTimeAll; ComboBoxE_l.Text = SysParam.Instance.comboBoxTimeL; ComboBoxE_m.Text = SysParam.Instance.comboBoxTimeM; ComboBoxE_h.Text = SysParam.Instance.comboBoxTimeH; ComboBoxE_f.Text = SysParam.Instance.comboBoxTimeFre; ComboBox_Orig_dt.Text = SysParam.Instance.ComboBoxTimeFilt; label3.Text = "0-" + (SysParam.Instance.sampleFre / 2).ToString() + "Hz"; label2.Enabled = CheckBox_Orig_dt.Checked; label3.Enabled = CheckBox_Orig_dt.Checked; textBox1.Text = SysParam.Instance.textBoxf1; textBox2.Text = SysParam.Instance.textBoxf2; } private void CheckBox_all_CheckedChanged(object sender, EventArgs e) { SysParam.Instance.checkBoxTimeAll = CheckBox_all.Checked; ComboBoxE_all.Enabled = CheckBox_all.Checked; } private void CheckBox_l_CheckedChanged(object sender, EventArgs e) { SysParam.Instance.checkBoxTimeL = CheckBox_l.Checked; ComboBoxE_l.Enabled = CheckBox_l.Checked; } private void CheckBox_m_CheckedChanged(object sender, EventArgs e) { SysParam.Instance.checkBoxTimeM = CheckBox_m.Checked; ComboBoxE_m.Enabled = CheckBox_m.Checked; } private void CheckBox_h_CheckedChanged(object sender, EventArgs e) { SysParam.Instance.checkBoxTimeH = CheckBox_h.Checked; ComboBoxE_h.Enabled = CheckBox_h.Checked; } private void CheckBox_f_CheckedChanged(object sender, EventArgs e) { SysParam.Instance.checkBoxTimeFre = CheckBox_f.Checked; ComboBoxE_f.Enabled = CheckBox_f.Checked; } private void CheckBox_r_CheckedChanged(object sender, EventArgs e) { SysParam.Instance.checkBoxTimeFilt = CheckBox_Orig_dt.Checked; ComboBox_Orig_dt.Enabled = CheckBox_Orig_dt.Checked; textBox1.Enabled = CheckBox_Orig_dt.Checked; textBox2.Enabled = CheckBox_Orig_dt.Checked; label2.Enabled = CheckBox_Orig_dt.Checked; label3.Enabled = CheckBox_Orig_dt.Checked; } private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { SysParam.Instance.comboBoxTimeAll = ComboBoxE_all.Text; } private void comboBox2_SelectedIndexChanged(object sender, EventArgs e) { SysParam.Instance.comboBoxTimeL = ComboBoxE_l.Text; } private void comboBox3_SelectedIndexChanged(object sender, EventArgs e) { SysParam.Instance.comboBoxTimeM = ComboBoxE_m.Text; } private void comboBox4_SelectedIndexChanged(object sender, EventArgs e) { SysParam.Instance.comboBoxTimeH = ComboBoxE_h.Text; } private void comboBox5_SelectedIndexChanged(object sender, EventArgs e) { SysParam.Instance.comboBoxTimeFre = ComboBoxE_f.Text; } //start 20151029 jxp private void ComboBoxE_all_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { double txtValue = 0d; if (double.TryParse(ComboBoxE_all.Text, out txtValue)) { if (txtValue >0) { SysParam.Instance.comboBoxTimeAll = ComboBoxE_all.Text; } else { ComboBoxE_all.Text = SysParam.Instance.comboBoxTimeAll; MessageBox.Show("趋势图的Y轴幅值需大于0"); } } else { ComboBoxE_all.Text = SysParam.Instance.comboBoxTimeAll; } } } private void ComboBoxE_l_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { double txtValue = 0d; if (double.TryParse(ComboBoxE_l.Text, out txtValue)) { if (txtValue>0) { SysParam.Instance.comboBoxTimeL = ComboBoxE_l.Text; } else { ComboBoxE_l.Text = SysParam.Instance.comboBoxTimeL; MessageBox.Show("趋势图的Y轴幅值需大于0"); } } else { ComboBoxE_l.Text = SysParam.Instance.comboBoxTimeL; } } } private void ComboBoxE_m_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { double txtValue = 0d; if (double.TryParse(ComboBoxE_m.Text, out txtValue)) { if (txtValue>0) { SysParam.Instance.comboBoxTimeM = ComboBoxE_m.Text; } else { ComboBoxE_m.Text = SysParam.Instance.comboBoxTimeM; MessageBox.Show("趋势图的Y轴幅值需大于0"); } } else { ComboBoxE_m.Text = SysParam.Instance.comboBoxTimeM; } } } private void ComboBoxE_h_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { double txtValue = 0d; if (double.TryParse(ComboBoxE_h.Text, out txtValue)) { if (txtValue>0) { SysParam.Instance.comboBoxTimeH = ComboBoxE_h.Text; } else { ComboBoxE_h.Text = SysParam.Instance.comboBoxTimeH; MessageBox.Show("趋势图的Y轴幅值需大于0"); } } else { ComboBoxE_h.Text = SysParam.Instance.comboBoxTimeH; } } } private void ComboBoxE_f_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { double txtValue = 0d; if (double.TryParse(ComboBoxE_f.Text, out txtValue)) { if (txtValue>0) { SysParam.Instance.comboBoxTimeFre = ComboBoxE_f.Text; } else { ComboBoxE_f.Text = SysParam.Instance.comboBoxTimeFre; MessageBox.Show("趋势图的Y轴幅值需大于0"); } } else { ComboBoxE_f.Text = SysParam.Instance.comboBoxTimeFre; } } } private void ComboBox_Orig_dt_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { double txtValue = 0d; if (double.TryParse(ComboBox_Orig_dt.Text, out txtValue)) { if (txtValue>0) { SysParam.Instance.ComboBoxTimeFilt = ComboBox_Orig_dt.Text; } else { ComboBox_Orig_dt.Text = SysParam.Instance.ComboBoxTimeFilt; MessageBox.Show("趋势图的Y轴幅值需大于0"); } } else { ComboBox_Orig_dt.Text = SysParam.Instance.ComboBoxTimeFilt; } } } private void textBox1_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { int f1 = 0; int f2 = 0; if (int.TryParse(textBox1.Text.Trim(), out f1) && int.TryParse(textBox2.Text.Trim(), out f2)) { if (f1 >= 0 && f2 >= 0 && f1 <= SysParam.Instance.sampleFre / 2 && f2 <= SysParam.Instance.sampleFre / 2) { if (f1 < f2) { SysParam.Instance.textBoxf1 = textBox1.Text.Trim(); SysParam.Instance.textBoxf2 = textBox2.Text.Trim(); } else { textBox1.Text = SysParam.Instance.textBoxf1; textBox2.Text = SysParam.Instance.textBoxf2; MessageBox.Show("用户输入的最大值需大于最小值!"); return; } } else { textBox1.Text = SysParam.Instance.textBoxf1; textBox2.Text = SysParam.Instance.textBoxf2; MessageBox.Show("用户输入值需在提示的带通范围内!"); return; } } else { textBox1.Text = SysParam.Instance.textBoxf1; textBox2.Text = SysParam.Instance.textBoxf2; MessageBox.Show("用户输入的带通范围最大值最小值必须为正整数!"); return; } textBox1.Focus(); } } private void textBox2_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { int f1 = 0; int f2 = 0; if (int.TryParse(textBox1.Text.Trim(), out f1) && int.TryParse(textBox2.Text.Trim(), out f2)) { if (f1 >= 0 && f2 >= 0 && f1 <= SysParam.Instance.sampleFre / 2 && f2 <= SysParam.Instance.sampleFre / 2) { if (f1 < f2) { SysParam.Instance.textBoxf1 = textBox1.Text.Trim(); SysParam.Instance.textBoxf2 = textBox2.Text.Trim(); } else { textBox1.Text = SysParam.Instance.textBoxf1; textBox2.Text = SysParam.Instance.textBoxf2; MessageBox.Show("用户输入的最大值需大于最小值!"); return; } } else { textBox1.Text = SysParam.Instance.textBoxf1; textBox2.Text = SysParam.Instance.textBoxf2; MessageBox.Show("用户输入值需在提示的带通范围内!"); return; } } else { textBox1.Text = SysParam.Instance.textBoxf1; textBox2.Text = SysParam.Instance.textBoxf2; MessageBox.Show("用户输入的带通范围最大值最小值必须为正整数!"); return; } textBox2.Focus(); } } private void checkBox_X10_CheckedChanged(object sender, EventArgs e) { SysParam.Instance.checkBoxTime = checkBox_X10.Checked; if (SysParam.Instance.checkBoxTime) { CheckBox_all.Enabled = true; CheckBox_h.Enabled = true; CheckBox_l.Enabled = true; CheckBox_m.Enabled = true; CheckBox_f.Enabled = true; CheckBox_Orig_dt.Enabled = true; } else { CheckBox_all.Checked = false; CheckBox_h.Checked = false; CheckBox_l.Checked = false; CheckBox_m.Checked = false; CheckBox_f.Checked = false; CheckBox_Orig_dt.Checked = false; CheckBox_all.Enabled = false; CheckBox_h.Enabled = false; CheckBox_l.Enabled = false; CheckBox_m.Enabled = false; CheckBox_f.Enabled = false; CheckBox_Orig_dt.Enabled = false; } } private void ComboBox_Orig_dt_SelectedIndexChanged(object sender, EventArgs e) { SysParam.Instance.ComboBoxTimeFilt = ComboBox_Orig_dt.Text; } } }