private void OnSelect(object sender, EventArgs e) { //用来调用子类里重写了的方法的全局变量 //this.currentDevice = new Dynamic_Cylinder(); ////动态油缸子类对象实例化 this.currentTest = new Dynamic_Cylinder(); if (checkedListBox.SelectedIndex == 0) { // this.currentTest.试验类型.Add(TestType.试运转试验); // public static int Num = 0; this.currentTest.StartWorkTest(); } else if (checkedListBox.SelectedIndex == 1) { this.currentTest.StartPressureTest(); } else if (checkedListBox.SelectedIndex == 2) { this.currentTest.PressTest(); } else if (checkedListBox.SelectedIndex == 3) { this.currentTest.EnduranceTest(); } else if (checkedListBox.SelectedIndex == 4) { } else if (checkedListBox.SelectedIndex == 5) { } else if (checkedListBox.SelectedIndex == 6) { MessageBox.Show("请调节RF1溢流阀压力为5Mpa", "进入缓冲试验"); this.Close(); this.currentTest.StartBufferTest(); //this.currentTest.Items.Add(TestType.缓冲试验); } else if (checkedListBox.SelectedIndex == 7) { } else if (checkedListBox.SelectedIndex == 8) { this.currentTest.LoadEfficiencyTest(); MessageBox.Show("进入负载实验", "进入负载实验"); // this.currentTest.Items.Add(TestType.负载效率试验); // this.Close(); } else if (checkedListBox.SelectedIndex == 9) { //this.currentTest.testTypes.Add(TestType.负载效率试验); this.currentTest.LoadEfficiencyTest(); } //if (this.SelectedValve == null) // return; // this.DialogResult = DialogResult.OK; //this.Close(); }
// 试验配置按钮 private void OnChoose(object sender, EventArgs e) { //选择实验界面实例变量 //FormValveSelect frm = new FormValveSelect(); this.currentTest = new Dynamic_Cylinder(); if (checkedListBox.SelectedIndex == 0) { this.currentTest.StartWorkTest(); } else if (checkedListBox.SelectedIndex == 1) { this.currentTest.StartPressureTest(); } else if (checkedListBox.SelectedIndex == 2) { this.currentTest.PressTest(); } else if (checkedListBox.SelectedIndex == 3) { this.currentTest.EnduranceTest(); } else if (checkedListBox.SelectedIndex == 4) { } else if (checkedListBox.SelectedIndex == 5) { } else if (checkedListBox.SelectedIndex == 6) { MessageBox.Show("请调节RF1溢流阀压力为5Mpa", "进入缓冲试验"); //this.currentTest.Items.Add(TestType.缓冲试验); MainForm.test = 6; AllowTest(); } else if (checkedListBox.SelectedIndex == 7) { } else if (checkedListBox.SelectedIndex == 8) { // this.currentTest.LoadEfficiencyTest(); MainForm.test = 8; AllowTest(); // this.currentTest.Items.Add(TestType.负载效率试验); // this.Close(); } else if (checkedListBox.SelectedIndex == 9) { // this.currentTest.LoadEfficiencyTest(); // AllowTest(); // MainForm.test = 8; } else if (checkedListBox.SelectedIndex == 10) { //this.currentTest.testTypes.Add(TestType.负载效率试验); this.currentTest.LoadEfficiencyTest(); } }
public FormValveSelect() { InitializeComponent(); //context = new MainProj.Local.LocalDbContext(); //context.Dynamic_Cylinders.Load(); foreach (TestType xt in Dynamic_Cylinder.GetSupportedTestType()) { this.checkedListBox.Items.Add(xt); } //Dynamic_CylinderCurrentChanged(null, null); }
/// <summary> /// 构造函数,作用是初始化界面 /// </summary> public MainForm() { InitializeComponent(); //连接通道 server.Run(); //计时器++开始 foreach (TestType xt in Dynamic_Cylinder.GetSupportedTestType()) { this.checkedListBox.Items.Add(xt); } }
private void MainForm_Load(object sender, EventArgs e) { timer2.Start(); //窗体加载时子类对象实例化为非空 this.currentTest = new Dynamic_Cylinder(); }