private void btnnew_Click(object sender, EventArgs e) { GlobeVal.selcontroller = cbomachine.SelectedIndex + 1; ClsStaticStation.m_Global.currentmachineId = GlobeVal.selcontroller - 1; (Application.OpenForms["FormMainLab"] as FormMainLab).lblcontroller.Text = GlobeVal.selcontroller.ToString().Trim(); if (GlobeVal.myarm.MyTransferData.EDC_STATE[GlobeVal.selcontroller - 1] == Convert.ToInt16(ClsStaticStation.modMain.EDC_State.EDC_STATE_TEST)) { MessageBox.Show("试验进行中,请先结束试验"); return; } UserControlMain c = GlobeVal.FormmainLab.umain; c.OpenTest(); (Application.OpenForms["FormMainLab"] as FormMainLab).tabControl1.SelectedIndex = 1; }
public void btntest_Click(object sender, EventArgs e) { ClsStaticStation.m_Global.mycls.initchannel(); TabControl b = ((TabControl)Application.OpenForms["FormMainLab"].Controls["tabcontrol1"]); ((SplitContainer)b.TabPages[1].Controls[0]).Panel2Collapsed = false; double t = System.Environment.TickCount; while (System.Environment.TickCount - t <= 500) { Application.DoEvents(); } UserControlMain c = GlobeVal.FormmainLab.umain; if (GlobeVal.mysys.machinekind == 3) { GlobeVal.FormmainLab.UserControl东光1.Init(); } if (GlobeVal.FormmainLab.UserControl轴向1 != null) { GlobeVal.FormmainLab.UserControl轴向1.init(); } if (GlobeVal.FormmainLab.UserControl刚度双轴1 != null) { GlobeVal.FormmainLab.UserControl刚度双轴1.init(); } c.OpenTest(); b.SelectedIndex = 1; }
private void FormMainLab_Load(object sender, EventArgs e) { GlobeVal.Init_Global_String_resource(); GlobeVal.MainStatusStrip = this.statusStrip1; GlobeVal.FormmainLab = this; this.Language(); GlobeVal.dopanel = panel2; this.Left = 0; this.Top = 0; jMeter1.BackColor = topbackcolor; jMeter2.BackColor = topbackcolor; jMeter3.BackColor = topbackcolor; jMeter4.BackColor = topbackcolor; jMeter1.init(); jMeter2.init(); jMeter3.init(); jMeter4.init(); jMeter1.Language(); jMeter2.Language(); jMeter3.Language(); jMeter4.Language(); mlistmeter = new List <JMeter>(); mlistmeter.Add(jMeter1); mlistmeter.Add(jMeter2); mlistmeter.Add(jMeter3); mlistmeter.Add(jMeter4); mlistkey = new List <Button>(); mlistkey.Add(btnkey1); mlistkey.Add(btnkey2); mlistkey.Add(btnkey3); mlistkey.Add(btnkey4); UTop = new TabHeaderDemo.UserControlTop(); UTop.Dock = DockStyle.Fill; UTop.Language(); panel5.Controls.Add(UTop); umain = new UserControlMain(); umain.Dock = DockStyle.Fill; splitContainer1.Panel1.Controls.Add(umain); backimage = new Bitmap(this.imageList1.Images[0], this.imageList1.Images[0].Size); this.Width = Convert.ToInt32(Screen.PrimaryScreen.Bounds.Width); this.Height = Convert.ToInt32(Screen.PrimaryScreen.Bounds.Height); // this.Width = 1024; // this.Height = 768; tabControl1.ItemSize = new Size(1, 1); if (GlobeVal.mysys.language == 0) { toolTip1.SetToolTip(btnmethod, "试验标准编辑器"); toolTip1.SetToolTip(btnon, "全部清零"); toolTip1.SetToolTip(recordStartButton, "开始录制"); toolTip1.SetToolTip(playBackMacroButton, "操作回放"); toolTip1.SetToolTip(recordStopButton, "停止录制"); toolTip1.SetToolTip(btnread, "读取演示文件"); } else { toolTip1.SetToolTip(btnmethod, "Test criteria editor"); toolTip1.SetToolTip(btnon, "Clear all channels"); toolTip1.SetToolTip(recordStartButton, "Start recording"); toolTip1.SetToolTip(playBackMacroButton, "Playback"); toolTip1.SetToolTip(recordStopButton, "Stop recording"); toolTip1.SetToolTip(btnread, "Read demo file"); } GlobeVal.myarm = mybcontrol; if (GlobeVal.mysys.machinekind == 2) { } if (GlobeVal.mysys.machinekind == 6) { tlpsel.Visible = false; UserControl操作面板1 = new UserControl操作面板(); UserControl刚度双轴1 = new UserControl刚度双轴(); UserControl操作面板1.Controls.Add(UserControl刚度双轴1); UserControl刚度双轴1.Dock = DockStyle.Fill; UserControl操作面板1.Dock = DockStyle.Fill; panel2.Controls.Add(UserControl操作面板1); } if ((GlobeVal.mysys.machinekind == 0) || (GlobeVal.mysys.machinekind == 5)) { tlpsel.Visible = false; UserControl操作面板1 = new UserControl操作面板(); UserControl轴向1 = new UserControl轴向(); UserControl操作面板1.Controls.Add(UserControl轴向1); UserControl轴向1.Dock = DockStyle.Fill; UserControl操作面板1.Dock = DockStyle.Fill; panel2.Controls.Add(UserControl操作面板1); } if (GlobeVal.mysys.machinekind == 1) { tlpsel.Visible = false; UserControl操作面板1 = new UserControl操作面板(); UserControl扭转1 = new UserControl扭转(); UserControl操作面板1.Controls.Add(UserControl扭转1); UserControl扭转1.Dock = DockStyle.Fill; UserControl操作面板1.Dock = DockStyle.Fill; panel2.Controls.Add(UserControl操作面板1); } if (GlobeVal.mysys.machinekind == 3) { tlpsel.Visible = false; UserControl操作面板1 = new UserControl操作面板(); UserControl东光1 = new UserControl东光(); UserControl操作面板1.Controls.Add(UserControl东光1); UserControl东光1.Dock = DockStyle.Fill; UserControl操作面板1.Dock = DockStyle.Fill; panel2.Controls.Add(UserControl操作面板1); } if (GlobeVal.mysys.machinekind == 4) { tlpsel.Visible = false; UserControl操作面板1 = new UserControl操作面板(); UserControl轴向恒应变1 = new UserControl轴向恒应变(); UserControl操作面板1.Controls.Add(UserControl轴向恒应变1); UserControl轴向恒应变1.Dock = DockStyle.Fill; UserControl操作面板1.Dock = DockStyle.Fill; panel2.Controls.Add(UserControl操作面板1); } if (GlobeVal.mysys.demo == true) { if (GlobeVal.mysys.language == 0) { GlobeVal.MainStatusStrip.Items["tslbldevice"].Text = "演示"; } else { GlobeVal.MainStatusStrip.Items["tslbldevice"].Text = "Demo"; } } else { GlobeVal.MainStatusStrip.Items["tslbldevice"].Text = GlobeVal.mysys.ControllerName[GlobeVal.mysys.controllerkind]; } /* * * if (IsRegeditExit("AppleLabJ") == true) * { * * } * else * { * reg(); * } * * string info = ""; * RegistryKey Key; * Key = Registry.LocalMachine; * RegistryKey software = Key.OpenSubKey("software\\AppleLabJ"); * // myreg = Key.OpenSubKey("software\\test",true); * info = software.GetValue("AppleLabJ").ToString(); * * GlobeVal.mysys.softwareconfig = info; * * info = software.GetValue("InstallData").ToString(); * * GlobeVal.mysys.softwareinstalldate = info; * * * * software.Close(); * */ if (GlobeVal.mysys.showshorttitle == false) { UTop.wordArt1.Caption = "AppleLab"; } else { UTop.wordArt1.Caption = GlobeVal.mysys.Lshorttitle[GlobeVal.mysys.language]; } if (GlobeVal.mysys.showlogo == true) { if (System.IO.File.Exists(System.Windows.Forms.Application.StartupPath + "\\AppleLabJ" + "\\bmp\\" + GlobeVal.mysys.bmplogo)) { UTop.paneldefine.BackgroundImage = Image.FromFile(System.Windows.Forms.Application.StartupPath + "\\AppleLabJ" + "\\bmp\\" + GlobeVal.mysys.bmplogo); UTop.panel6.Visible = false; UTop.paneldefine.Visible = true; } else { UTop.panel6.Visible = true; UTop.paneldefine.Visible = false; } } else { UTop.panel6.Visible = true; UTop.paneldefine.Visible = false; } UTop.Refresh(); timermain.Enabled = true; if (GlobeVal.mysys.safe == true) { if (GlobeVal.mysys.startupscreen == 0) { Frm.Form登录 f = new TabHeaderDemo.Frm.Form登录(); f.result = false; f.ShowDialog(); if (f.result == true) { } else { Close(); } f.Close(); } } if (GlobeVal.mysys.controllerkind == 0) { if (GlobeVal.mysys.machinekind == 3) { } else { //cdriverdll = new DriverDll.CDriver(); // cdriverdll.Start(); } } if (Screen.PrimaryScreen.Bounds.Width == 1366) { splitContainer1.SplitterDistance = 1050; paneltop.Height = 106; tlbmeterback.Height = 64; } else { // splitContainer1.SplitterDistance = 980; // tlbmeterback.Height = 84; // paneltop.Height = 126; } if (GlobeVal.mysys.startupscreen == 1) { ((SplitContainer)tabControl1.TabPages[1].Controls[0]).Panel2Collapsed = false; double t = System.Environment.TickCount; while (System.Environment.TickCount - t <= 500) { Application.DoEvents(); } if (GlobeVal.mysys.machinekind == 3) { GlobeVal.FormmainLab.UserControl东光1.Init(); } umain.OpenTest(); tabControl1.SelectedIndex = 1; string fileName = System.Windows.Forms.Application.StartupPath + "\\AppleLabJ" + "\\Method\\" + GlobeVal.userControlpretest1.listView1.Items[0].SubItems[1].Text + "\\" + GlobeVal.userControlpretest1.listView1.Items[0].Text + ".dat"; if (CComLibrary.GlobeVal.filesave == null) { CComLibrary.GlobeVal.filesave = new CComLibrary.FileStruct(); } CComLibrary.GlobeVal.filesave = CComLibrary.GlobeVal.filesave.DeSerializeNow(fileName); ClsStaticStation.m_Global.mycls.initchannel(); ((FormMainLab)Application.OpenForms["FormMainLab"]).InitKey(); ((FormMainLab)Application.OpenForms["FormMainLab"]).InitMeter(); GlobeVal.userControlpretest1.gfilename = fileName; CComLibrary.GlobeVal.currentfilesavename = fileName; if (System.IO.Directory.Exists(GlobeVal.mysys.SamplePath)) { } else { if (GlobeVal.mysys.language == 0) { MessageBox.Show("数据保存路径不存在,请点击浏览选择试验路径"); } else { MessageBox.Show("The data save directory does not exist.Please click Browse to select the directory"); } return; } if (GlobeVal.mysys.SamplePath == "") { if (GlobeVal.mysys.language == 0) { MessageBox.Show("请设置数据保存路径"); } else { MessageBox.Show("Please set the data save directory"); } return; } if (GlobeVal.mysys.language == 0) { GlobeVal.spefilename = GlobeVal.mysys.SamplePath + "\\" + "未命名" + ".spe"; } else { GlobeVal.spefilename = GlobeVal.mysys.SamplePath + "\\" + "Unnamed" + ".spe"; } GlobeVal.userControlpretest1.SampleNextStep(true); CComLibrary.GlobeVal.filesave.currentspenumber = 0; if (GlobeVal.FormmainLab.UserControl轴向1 != null) { GlobeVal.FormmainLab.UserControl轴向1.init(); } if (GlobeVal.FormmainLab.UserControl刚度双轴1 != null) { GlobeVal.FormmainLab.UserControl刚度双轴1.init(); } } tslblEmergencyStop.Visible = false; tslbllimit.Visible = false; tslblstate.Visible = false; }
public void _直接进入试验界面() { GlobeVal.UserControlMain1.btnmtest.Text = "测试"; this.Cursor = Cursors.WaitCursor; double t = System.Environment.TickCount; umain.OpenTest(); tabControl1.SelectedIndex = 0; string fileName = System.Windows.Forms.Application.StartupPath + "\\AppleLabJ\\device\\" + GlobeVal.selcontroller.ToString().Trim() + "\\para\\方法.dat"; if (CComLibrary.GlobeVal.filesave == null) { CComLibrary.GlobeVal.filesave = new CComLibrary.FileStruct(); } CComLibrary.GlobeVal.filesave = CComLibrary.GlobeVal.filesave.DeSerializeNow(fileName); if (UserControl操作面板1 == null) { UserControl操作面板1 = new UserControl操作面板(); UserControl轴向1 = new UserControl轴向(); UserControl操作面板1.Controls.Add(UserControl轴向1); UserControl轴向1.Dock = DockStyle.Fill; UserControl操作面板1.Dock = DockStyle.Fill; } GlobeVal.userControltest1.panelright.Controls.Clear(); GlobeVal.userControltest1.panelright.Controls.Add(UserControl操作面板1); ClsStaticStation.m_Global.mycls.initchannel(); ((FormMainLab)Application.OpenForms["FormMainLab"]).InitKey(); ((FormMainLab)Application.OpenForms["FormMainLab"]).InitMeter(); GlobeVal.userControlpretest1.gfilename = fileName; CComLibrary.GlobeVal.currentfilesavename = fileName; if (GlobeVal.myglobefile.SamplePath == "") { MessageBox.Show("请设置数据保存路径"); return; } if (System.IO.Directory.Exists(GlobeVal.myglobefile.SamplePath)) { } else { MessageBox.Show("数据保存路径不存在,请点击浏览选择试验路径,将重新设置为c:\\data"); GlobeVal.myglobefile.SamplePath = "c:\\data"; //return; } GlobeVal.spefilename = GlobeVal.myglobefile.SamplePath + "\\" + "未命名" + ".spe"; GlobeVal.userControlpretest1.SampleNextStep(true); this.Cursor = Cursors.Default; tabControl1.SelectedIndex = 1; CComLibrary.GlobeVal.filesave.currentspenumber = 0; }