460 lines
17 KiB
C#
460 lines
17 KiB
C#
using System;
|
||
using System.Windows.Forms;
|
||
using CRVM.Entity;
|
||
namespace CRVM
|
||
{
|
||
public partial class GraCheckedTimeRe : UserControl//20151102 jxp
|
||
{
|
||
|
||
public delegate void ContentHandler(object sender, EventArgs e);
|
||
public event ContentHandler ContentChanged;
|
||
public GraCheckedTimeRe()
|
||
{
|
||
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;
|
||
label3.Text = "0-" + (SysParam.Instance.sampleFre / 2).ToString() + "Hz";
|
||
label2.Enabled = CheckBox_Orig_dt.Checked;
|
||
label3.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;
|
||
|
||
textBox1.Text = SysParam.Instance.textBoxf1;
|
||
textBox2.Text = SysParam.Instance.textBoxf2;
|
||
|
||
textBox3.Text = SysParam.Instance.reTimeSpan;
|
||
}
|
||
|
||
private void CheckBox_all_CheckedChanged(object sender, EventArgs e)
|
||
{
|
||
SysParam.Instance.checkBoxTimeAll = CheckBox_all.Checked;
|
||
ComboBoxE_all.Enabled = CheckBox_all.Checked;
|
||
Contentchanged();
|
||
}
|
||
|
||
private void CheckBox_l_CheckedChanged(object sender, EventArgs e)
|
||
{
|
||
SysParam.Instance.checkBoxTimeL = CheckBox_l.Checked;
|
||
ComboBoxE_l.Enabled = CheckBox_l.Checked;
|
||
Contentchanged();
|
||
}
|
||
|
||
private void CheckBox_m_CheckedChanged(object sender, EventArgs e)
|
||
{
|
||
SysParam.Instance.checkBoxTimeM = CheckBox_m.Checked;
|
||
ComboBoxE_m.Enabled = CheckBox_m.Checked;
|
||
Contentchanged();
|
||
}
|
||
|
||
private void CheckBox_h_CheckedChanged(object sender, EventArgs e)
|
||
{
|
||
SysParam.Instance.checkBoxTimeH = CheckBox_h.Checked;
|
||
ComboBoxE_h.Enabled = CheckBox_h.Checked;
|
||
Contentchanged();
|
||
}
|
||
|
||
private void CheckBox_f_CheckedChanged(object sender, EventArgs e)
|
||
{
|
||
SysParam.Instance.checkBoxTimeFre = CheckBox_f.Checked;
|
||
ComboBoxE_f.Enabled = CheckBox_f.Checked;
|
||
Contentchanged();
|
||
}
|
||
|
||
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;
|
||
Contentchanged();
|
||
}
|
||
|
||
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
|
||
{
|
||
SysParam.Instance.comboBoxTimeAll = ComboBoxE_all.Text;
|
||
Contentchanged();
|
||
}
|
||
|
||
private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
|
||
{
|
||
SysParam.Instance.comboBoxTimeL = ComboBoxE_l.Text;
|
||
Contentchanged();
|
||
}
|
||
|
||
private void comboBox3_SelectedIndexChanged(object sender, EventArgs e)
|
||
{
|
||
SysParam.Instance.comboBoxTimeM = ComboBoxE_m.Text;
|
||
Contentchanged();
|
||
}
|
||
|
||
private void comboBox4_SelectedIndexChanged(object sender, EventArgs e)
|
||
{
|
||
SysParam.Instance.comboBoxTimeH = ComboBoxE_h.Text;
|
||
Contentchanged();
|
||
}
|
||
|
||
private void comboBox5_SelectedIndexChanged(object sender, EventArgs e)
|
||
{
|
||
SysParam.Instance.comboBoxTimeFre = ComboBoxE_f.Text;
|
||
Contentchanged();
|
||
}
|
||
|
||
|
||
private void Contentchanged()
|
||
{
|
||
if (ContentChanged != null)
|
||
{
|
||
ContentChanged(this, new EventArgs());
|
||
}
|
||
}
|
||
//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;
|
||
return;
|
||
}
|
||
}
|
||
Contentchanged();
|
||
}
|
||
|
||
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;
|
||
return;
|
||
}
|
||
}
|
||
Contentchanged();
|
||
}
|
||
|
||
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;
|
||
return;
|
||
}
|
||
}
|
||
Contentchanged();
|
||
}
|
||
|
||
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;
|
||
return;
|
||
}
|
||
}
|
||
Contentchanged();
|
||
}
|
||
|
||
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;
|
||
return;
|
||
}
|
||
}
|
||
Contentchanged();
|
||
}
|
||
|
||
|
||
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;
|
||
return;
|
||
}
|
||
}
|
||
Contentchanged();
|
||
}
|
||
|
||
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();
|
||
}
|
||
Contentchanged();
|
||
}
|
||
|
||
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();
|
||
}
|
||
Contentchanged();
|
||
}
|
||
|
||
|
||
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;
|
||
textBox3.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;
|
||
textBox3.Enabled = false;
|
||
}
|
||
Contentchanged();
|
||
}
|
||
|
||
private void ComboBox_Orig_dt_SelectedIndexChanged(object sender, EventArgs e)
|
||
{
|
||
SysParam.Instance.ComboBoxTimeFilt = ComboBox_Orig_dt.Text;
|
||
Contentchanged();
|
||
}
|
||
|
||
private void textBox3_KeyDown(object sender, KeyEventArgs e)
|
||
{
|
||
if (e.KeyCode == Keys.Enter)
|
||
{
|
||
int txtValue = 0;
|
||
if (int.TryParse(textBox3.Text, out txtValue))
|
||
{
|
||
if (txtValue > 0)
|
||
{
|
||
if (txtValue >6)
|
||
{
|
||
textBox3.Text = "6";
|
||
}
|
||
SysParam.Instance.reTimeSpan = textBox3.Text;
|
||
}
|
||
else
|
||
{
|
||
textBox3.Text = SysParam.Instance.reTimeSpan;
|
||
MessageBox.Show("用户输入的图表的X轴显示宽度不得小于0!");
|
||
return;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
textBox3.Text = SysParam.Instance.reTimeSpan;
|
||
MessageBox.Show("用户输入的图表的X轴显示宽度需是大于0的正整数!");
|
||
return;
|
||
}
|
||
}
|
||
Contentchanged();
|
||
}
|
||
}
|
||
}
|