Ejemplo n.º 1
0
        private void printDocument1_BeginPrint(object sender, System.Drawing.Printing.PrintEventArgs e)
        {
            int i = 0;

            char[] param = { '\n' };

            ListBox ml = new ListBox();

            GlobeVal.putlistboxitem(ml);

            lines = new string[ml.Items.Count];

            for (i = 0; i < ml.Items.Count; i++)
            {
                lines[i] = Convert.ToString(ml.Items[i]);
            }
        }
Ejemplo n.º 2
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 btneopen_Click(object sender, EventArgs e)
        {
            if (tabControl1.SelectedIndex == 0)
            {
                if (listView1.SelectedIndices.Count > 0)
                {
                    string fileName = System.Windows.Forms.Application.StartupPath + "\\AppleLabJ" + "\\Method\\" + listView1.Items[listView1.SelectedIndices[0]].SubItems[1].Text + "\\"
                                      + listView1.Items[listView1.SelectedIndices[0]].Text + ".dat";
                    gfilename = fileName;

                    if (System.IO.File.Exists(fileName) == true)
                    {
                    }
                    else
                    {
                        MessageBox.Show("方法不存在");
                        return;
                    }

                    if (fileName == "")
                    {
                        return;
                    }
                    else
                    {
                        this.txtmethod.Text = Path.GetFileNameWithoutExtension(fileName);
                        this.txtpath.Text   = Path.GetDirectoryName(fileName);

                        if (CComLibrary.GlobeVal.filesave == null)
                        {
                            CComLibrary.GlobeVal.filesave = new CComLibrary.FileStruct();
                        }
                        CComLibrary.GlobeVal.filesave = CComLibrary.GlobeVal.filesave.DeSerializeNow(fileName);

                        CComLibrary.GlobeVal.currentfilesavename = fileName;

                        GlobeVal.putlistboxitem(listBox1);



                        ListViewItem lv = new ListViewItem();
                        lv.Text = this.txtmethod.Text;


                        lv.SubItems.Add(ClsStaticStation.m_Global.mycls.TestkindList[CComLibrary.GlobeVal.filesave.methodkind]);
                        lv.SubItems.Add(System.IO.File.GetLastWriteTime(fileName).ToLongDateString() + " " + System.IO.File.GetLastWriteTime(fileName).ToLongTimeString());



                        if (this.txtmethod.Text == listView1.Items[0].Text)
                        {
                            listView1.Items.RemoveAt(0);
                        }

                        if (listView1.Items.Count >= 20)
                        {
                            listView1.Items.RemoveAt(19);
                        }
                        listView1.Items.Insert(0, lv);

                        for (int i = 0; i < listView1.Items.Count; i++)
                        {
                            GlobeVal.myglobefile.RecentFilename[i]     = listView1.Items[i].Text;
                            GlobeVal.myglobefile.RecentFilenameKind[i] = listView1.Items[i].SubItems[1].Text;
                        }

                        for (int i = listView1.Items.Count; i < 20; i++)
                        {
                            GlobeVal.myglobefile.RecentFilename[i]     = "";
                            GlobeVal.myglobefile.RecentFilenameKind[i] = "";
                        }

                        ClsStaticStation.m_Global.mycls.initchannel();
                        ((FormMainLab)Application.OpenForms["FormMainLab"]).InitKey();
                        ((FormMainLab)Application.OpenForms["FormMainLab"]).InitMeter();

                        lblmethodkind.Text = ClsStaticStation.m_Global.mycls.TestkindList[CComLibrary.GlobeVal.filesave.methodkind];
                        lblmethod.Text     = this.txtmethod.Text;
                    }
                }

                else
                {
                    MessageBox.Show("请选择最近使用的试验方法");
                }
            }

            if (tabControl1.SelectedIndex == 2)
            {
                if (listView2.SelectedIndices.Count > 0)
                {
                    string fileName = listView2.Items[listView2.SelectedIndices[0]].SubItems[3].Text + "\\"
                                      + listView2.Items[listView2.SelectedIndices[0]].Text + ".spe";
                    gfilename = fileName;

                    if (System.IO.File.Exists(fileName) == true)
                    {
                    }
                    else
                    {
                        MessageBox.Show("样品文件不存在");
                        return;
                    }

                    if (fileName == "")
                    {
                        return;
                    }
                    else
                    {
                        this.txtsample.Text     = Path.GetFileNameWithoutExtension(fileName);
                        this.txtsamplepath.Text = Path.GetDirectoryName(fileName);

                        if (CComLibrary.GlobeVal.filesave == null)
                        {
                            CComLibrary.GlobeVal.filesave = new CComLibrary.FileStruct();
                        }
                        CComLibrary.GlobeVal.filesave = CComLibrary.GlobeVal.filesave.DeSerializeNow(fileName);

                        CComLibrary.GlobeVal.currentfilesavename = fileName;

                        GlobeVal.putlistboxitem(listBox2);


                        ListViewItem lv = new ListViewItem();
                        lv.Text = this.txtsample.Text;


                        lv.SubItems.Add(ClsStaticStation.m_Global.mycls.TestkindList[CComLibrary.GlobeVal.filesave.methodkind]);
                        lv.SubItems.Add(System.IO.File.GetLastWriteTime(fileName).ToLongDateString() + " " + System.IO.File.GetLastWriteTime(fileName).ToLongTimeString());
                        lv.SubItems.Add(Path.GetDirectoryName(fileName));

                        if (this.txtsample.Text == listView2.Items[0].Text)
                        {
                            listView2.Items.RemoveAt(0);
                        }


                        if (listView2.Items.Count >= 20)
                        {
                            listView2.Items.RemoveAt(19);
                        }
                        listView2.Items.Insert(0, lv);



                        for (int i = 0; i < listView2.Items.Count; i++)
                        {
                            GlobeVal.myglobefile.RecentSampleFilename[i]     = listView2.Items[i].Text;
                            GlobeVal.myglobefile.RecentSampleFilenameKind[i] = listView2.Items[i].SubItems[1].Text;
                            GlobeVal.myglobefile.RecentSampleFilePath[i]     = listView2.Items[i].SubItems[3].Text;
                        }

                        for (int i = listView2.Items.Count; i < 20; i++)
                        {
                            GlobeVal.myglobefile.RecentSampleFilename[i]     = "";
                            GlobeVal.myglobefile.RecentSampleFilenameKind[i] = "";
                            GlobeVal.myglobefile.RecentSampleFilePath[i]     = "";
                        }

                        ClsStaticStation.m_Global.mycls.initchannel();
                        ((FormMainLab)Application.OpenForms["FormMainLab"]).InitKey();
                        ((FormMainLab)Application.OpenForms["FormMainLab"]).InitMeter();

                        //lblmethodkind.Text = ClsStaticStation.m_Global.mycls.TestkindList[CComLibrary.GlobeVal.filesave.methodkind];
                        //lblmethod.Text = this.txtmethod.Text;
                    }
                }
                else
                {
                    MessageBox.Show("请选择最近使用的样本");
                }
            }
        }
        private void btnelook_Click(object sender, EventArgs e)
        {
            if (tabControl1.SelectedIndex == 2)
            {
                CustomControls.MethodOpenFileDialog controlex = new CustomControls.MethodOpenFileDialog();
                controlex.StartLocation               = AddonWindowLocation.Right;
                controlex.DefaultViewMode             = FolderViewMode.Details;
                controlex.OpenDialog.InitialDirectory = lblpath.Text;
                controlex.OpenDialog.AddExtension     = true;
                controlex.OpenDialog.Filter           = "样品文件(*.spe)|*.spe";
                controlex.ShowDialog(this);

                if (controlex.OpenDialog.FileName == null)
                {
                    return;
                }
                else
                {
                    string fileName = controlex.OpenDialog.FileName;
                    gfilename = fileName;
                    if (fileName == "")
                    {
                        return;
                    }
                    else
                    {
                        this.txtsample.Text     = Path.GetFileNameWithoutExtension(fileName);
                        this.txtsamplepath.Text = Path.GetDirectoryName(fileName);

                        if (CComLibrary.GlobeVal.filesave == null)
                        {
                            CComLibrary.GlobeVal.filesave = new CComLibrary.FileStruct();
                        }
                        CComLibrary.GlobeVal.filesave = CComLibrary.GlobeVal.filesave.DeSerializeNow(fileName);

                        CComLibrary.GlobeVal.currentfilesavename = fileName;


                        GlobeVal.putlistboxitem(listBox2);


                        ListViewItem lv = new ListViewItem();
                        lv.Text = this.txtsample.Text;


                        lv.SubItems.Add(ClsStaticStation.m_Global.mycls.TestkindList[CComLibrary.GlobeVal.filesave.methodkind]);
                        lv.SubItems.Add(System.IO.File.GetLastWriteTime(fileName).ToLongDateString() + " " + System.IO.File.GetLastWriteTime(fileName).ToLongTimeString());
                        lv.SubItems.Add(Path.GetDirectoryName(fileName));

                        if (listView2.Items.Count > 0)
                        {
                            if (this.txtsample.Text == listView2.Items[0].Text)
                            {
                                listView2.Items.RemoveAt(0);
                            }

                            if (listView2.Items.Count >= 20)
                            {
                                listView2.Items.RemoveAt(19);
                            }
                        }
                        listView2.Items.Insert(0, lv);



                        for (int i = 0; i < listView2.Items.Count; i++)
                        {
                            GlobeVal.myglobefile.RecentSampleFilename[i]     = listView2.Items[i].Text;
                            GlobeVal.myglobefile.RecentSampleFilenameKind[i] = listView2.Items[i].SubItems[1].Text;
                            GlobeVal.myglobefile.RecentSampleFilePath[i]     = listView2.Items[i].SubItems[3].Text;
                        }

                        for (int i = listView2.Items.Count; i < 20; i++)
                        {
                            GlobeVal.myglobefile.RecentSampleFilename[i]     = "";
                            GlobeVal.myglobefile.RecentSampleFilenameKind[i] = "";
                            GlobeVal.myglobefile.RecentSampleFilePath[i]     = "";
                        }

                        ClsStaticStation.m_Global.mycls.initchannel();
                        ((FormMainLab)Application.OpenForms["FormMainLab"]).InitKey();
                        ((FormMainLab)Application.OpenForms["FormMainLab"]).InitMeter();

                        //lblmethodkind.Text = ClsStaticStation.m_Global.mycls.TestkindList[CComLibrary.GlobeVal.filesave.methodkind];
                        //lblmethod.Text = this.txtmethod.Text;
                    }
                }

                controlex.Dispose();
            }
            if (tabControl1.SelectedIndex == 1)
            {
                this.folderBrowserDialog1.SelectedPath = lblpath.Text;
                this.folderBrowserDialog1.ShowDialog();

                lblpath.Text = this.folderBrowserDialog1.SelectedPath;

                GlobeVal.myglobefile.SamplePath = lblpath.Text;
            }
            if (tabControl1.SelectedIndex == 0)
            {
                CustomControls.MethodOpenFileDialog controlex = new CustomControls.MethodOpenFileDialog();
                controlex.StartLocation               = AddonWindowLocation.Right;
                controlex.DefaultViewMode             = FolderViewMode.Details;
                controlex.OpenDialog.InitialDirectory = System.Windows.Forms.Application.StartupPath + "\\AppleLabJ" + "\\Method";
                controlex.OpenDialog.AddExtension     = true;
                controlex.OpenDialog.Filter           = "试验方法文件(*.dat)|*.dat";
                controlex.ShowDialog(this);



                if (controlex.OpenDialog.FileName == null)
                {
                    return;
                }
                else
                {
                    string fileName = controlex.OpenDialog.FileName;
                    gfilename = fileName;

                    if (fileName == "")
                    {
                        return;
                    }
                    else
                    {
                        this.txtmethod.Text = Path.GetFileNameWithoutExtension(fileName);
                        this.txtpath.Text   = Path.GetDirectoryName(fileName);

                        if (CComLibrary.GlobeVal.filesave == null)
                        {
                            CComLibrary.GlobeVal.filesave = new CComLibrary.FileStruct();
                        }
                        CComLibrary.GlobeVal.filesave = CComLibrary.GlobeVal.filesave.DeSerializeNow(fileName);

                        CComLibrary.GlobeVal.currentfilesavename = fileName;

                        GlobeVal.putlistboxitem(listBox1);


                        ListViewItem lv = new ListViewItem();
                        lv.Text = this.txtmethod.Text;


                        lv.SubItems.Add(ClsStaticStation.m_Global.mycls.TestkindList[CComLibrary.GlobeVal.filesave.methodkind]);
                        lv.SubItems.Add(System.IO.File.GetLastWriteTime(fileName).ToLongDateString() + " " + System.IO.File.GetLastWriteTime(fileName).ToLongTimeString());


                        if (listView1.Items.Count > 0)
                        {
                            if (this.txtmethod.Text == listView1.Items[0].Text)
                            {
                                listView1.Items.RemoveAt(0);
                            }
                        }

                        if (listView1.Items.Count >= 20)
                        {
                            listView1.Items.RemoveAt(19);
                        }
                        listView1.Items.Insert(0, lv);



                        for (int i = 0; i < listView1.Items.Count; i++)
                        {
                            GlobeVal.myglobefile.RecentFilename[i]     = listView1.Items[i].Text;
                            GlobeVal.myglobefile.RecentFilenameKind[i] = listView1.Items[i].SubItems[1].Text;
                        }

                        for (int i = listView1.Items.Count; i < 20; i++)
                        {
                            GlobeVal.myglobefile.RecentFilename[i]     = "";
                            GlobeVal.myglobefile.RecentFilenameKind[i] = "";
                        }

                        ClsStaticStation.m_Global.mycls.initchannel();
                        ((FormMainLab)Application.OpenForms["FormMainLab"]).InitKey();
                        ((FormMainLab)Application.OpenForms["FormMainLab"]).InitMeter();

                        lblmethodkind.Text = ClsStaticStation.m_Global.mycls.TestkindList[CComLibrary.GlobeVal.filesave.methodkind];
                        lblmethod.Text     = this.txtmethod.Text;
                    }
                }

                controlex.Dispose();
            }
        }
Ejemplo n.º 5
0
        private void 重新计算当前试样ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string mspefiledat = "";


            int num = 0;

            if (lstspe.SelectedItem == null)
            {
                return;
            }


            num = Convert.ToInt16(lstspe.SelectedItem.Text);

            if (CComLibrary.GlobeVal.filesave.dt.Rows[num - 1]["试样状态"] is DBNull)
            {
                MessageBox.Show("试验后才能计算");
                return;
            }
            else
            {
                if (Convert.ToInt16(CComLibrary.GlobeVal.filesave.dt.Rows[num - 1]["试样状态"]) == Convert.ToInt16(CComLibrary.TestStatus.Untested))
                {
                    MessageBox.Show("试验后才能计算");
                    return;
                }
            }



            mspefiledat = GlobeVal.myglobefile.SamplePath + "\\" + GlobeVal.myglobefile.SampleFile + "-" +
                          (num).ToString().Trim() + ".txt";



            CComLibrary.GlobeVal.mscattergraph = userControlGraph1.userGraph1.scatterGraph1;

            //清除曲线上的箭头文本

            CComLibrary.GlobeVal.m_listline.Clear();

            userControlGraph1.userGraph1.scatterGraph1.Annotations.Clear();



            CComLibrary.GlobeVal.filesave.calc(mspefiledat);//计算数据
            if (CComLibrary.GlobeVal.filesave.UseDatabase == true)
            {
                if (System.IO.Directory.Exists(Application.StartupPath + "\\mdb\\") == true)
                {
                    System.IO.Directory.CreateDirectory(Application.StartupPath + "\\mdb\\");
                }
                CComLibrary.GlobeVal.filesave.samplename = System.IO.Path.GetFileNameWithoutExtension(GlobeVal.spefilename);
                CComLibrary.GlobeVal.filesave.Init_databaselist(true, num - 1);

                if (System.IO.File.Exists(Application.StartupPath + "\\mdb\\" + CComLibrary.GlobeVal.filesave.methodname + ".mdb") == false)
                {
                    GlobeVal.NewDatabase();
                }

                GlobeVal.SaveDatabase();
            }


            if (userControlResult1 != null)
            {
                userControlResult1.ReCalcGrid(1, true, false, CComLibrary.GlobeVal.filesave.mtablecol1, CComLibrary.GlobeVal.filesave.mtable1para,
                                              CComLibrary.GlobeVal.filesave.mtable1statistics, num - 1);
            }



            // FreeFormRefresh(true, false);



            CComLibrary.GlobeVal.filesave.SerializeNow(GlobeVal.spefilename);

            if (CComLibrary.GlobeVal.m_test == false)
            {
                userControlGraph1.userGraph1.scatterGraph1.Annotations.Clear();
                for (int i = 0; i < CComLibrary.GlobeVal.m_listline.Count; i++)
                {
                    if (CComLibrary.GlobeVal.m_listline[i].kind == 0)
                    {
                        // userControlGraph1.userGraph1.scatterGraph1.drawsign(CComLibrary.GlobeVal.m_listline[i].xstart, CComLibrary.GlobeVal.m_listline[i].ystart, CComLibrary.GlobeVal.m_listline[i]);
                    }
                    else if (CComLibrary.GlobeVal.m_listline[i].kind == 1)
                    {
                        // GlobeVal.UserControlGraph1.userGraph1.drawline(CComLibrary.GlobeVal.m_listline[i].xstart, CComLibrary.GlobeVal.m_listline[i].ystart,
                        //    CComLibrary.GlobeVal.m_listline[i].xend, CComLibrary.GlobeVal.m_listline[i].yend, CComLibrary.GlobeVal.m_listline[i]);
                    }
                }
            }
        }