Exemple #1
0
        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;
        }
        private void FormMainLab_Load(object sender, EventArgs e)
        {
            GlobeVal.MainStatusStrip = this.statusStrip1;

            GlobeVal.FormmainLab = this;



            this.Left = 0;
            this.Top  = 0;

            jMeter1.BackColor = topbackcolor;
            jMeter2.BackColor = topbackcolor;
            jMeter3.BackColor = topbackcolor;
            jMeter4.BackColor = topbackcolor;


            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;
            panel5.Controls.Add(UTop);
            umain      = new UserControlMain();
            umain.Dock = DockStyle.Fill;
            testpage.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);


            tabControl1.ItemSize = new Size(1, 1);



            GlobeVal.myarm = myarm;



            /*
             *
             * 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.myglobefile.showshorttitle == false)
            {
                UTop.wordArt1.Caption = "AppleLab";
            }
            else
            {
                UTop.wordArt1.Caption = GlobeVal.myglobefile.shorttitle;
            }

            if (GlobeVal.myglobefile.showlogo == true)
            {
                if (System.IO.File.Exists(System.Windows.Forms.Application.StartupPath + "\\AppleLabJ" + "\\bmp\\" + GlobeVal.myglobefile.bmplogo))
                {
                    UTop.paneldefine.BackgroundImage = Image.FromFile(System.Windows.Forms.Application.StartupPath + "\\AppleLabJ" + "\\bmp\\" + GlobeVal.myglobefile.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.myglobefile.safe == true)
            {
                Frm.Form登录 f = new TabHeaderDemo.Frm.Form登录();


                f.result = false;

                f.ShowDialog();

                if (f.result == true)
                {
                }
                else
                {
                    Close();
                }
                f.Close();
            }

            if (GlobeVal.myglobefile.controllerkind == 0)
            {
                if (GlobeVal.myglobefile.machinekind == 3)
                {
                }
                else
                {
                    //cdriverdll = new DriverDll.CDriver();
                    // cdriverdll.Start();
                }
            }

            if (Screen.PrimaryScreen.Bounds.Width == 1366)
            {
                paneltop.Height     = 106;
                tlbmeterback.Height = 64;
            }
            else
            {
            }


            if (GlobeVal.myglobefile.startupscreen == 1)
            {
                //直接启动试验界面

                _直接进入试验界面();
            }
        }