예제 #1
0
 //initialize interface
 private void InitInterface()
 {
     //clear TextBox
     GeneralFuc.ClearTextBox(this);
     //other
     cmbProductName.SelectedItem = null;
     maskedtxtDate.Text          = "00000000";
     defectGrid.Rows.Clear();
     cmbSampleGroType.SelectedItem = null;
     cobGrooveKind.SelectedItem    = null;
 }
예제 #2
0
 private void init()
 {
     tabControl1.Visible  = true;
     cmbName.SelectedItem = null;
     GeneralFuc.ClearTextBox(this);
     mstxtDate.Text = "00000000";
     wedge          = new UltraWedge();
     positions      = new UTPosition();
     openPath       = "";
     savePath       = "";
 }
예제 #3
0
        private bool EnsurePrm()
        {
            if (isexist == false)
            {
                MessageBox.Show("数据错误!", "警告");
                return(false);
            }
            else
            {
                //Empty boxes are set zero
                GeneralFuc.SetEmptyTextBox(this);
                //UI convert to class
                try
                {
                    wedge.date              = mstxtDate.Text;
                    wedge.name              = cmbName.Text;
                    wedge.type              = txtType.Text;
                    wedge.drawingPartNum    = txtDrawNum.Text;
                    wedge.sn                = txtSequenceNum.Text;
                    wedge.manu              = txtManufacturer.Text;
                    wedge.length            = double.Parse(txtLXH.Text);
                    wedge.width             = double.Parse(txtLXW.Text);
                    wedge.height            = double.Parse(txtLXH.Text);
                    wedge.headLen           = double.Parse(txtLDW.Text);
                    wedge.incidentAngle     = double.Parse(txtAngle.Text);
                    wedge.longVeloc         = double.Parse(txtLongVeloc.Text);
                    wedge.transVeloc        = double.Parse(txtTransVeloc.Text);
                    wedge.operTempMin       = double.Parse(txtOperTempMin.Text);
                    wedge.operTempMax       = double.Parse(txtOperTempMax.Text);
                    wedge.storeTemprMin     = double.Parse(txtStoreTemperMin.Text);
                    wedge.storeTemprMax     = double.Parse(txtStoreTemperMax.Text);
                    positions.probePosition = double.Parse(txtProbePos.Text);
                    positions.wedgePosition = double.Parse(txtWedgePos.Text);

                    //if (e != null)
                    //{
                    //    MessageBox.Show("data conversion success");
                    //}
                }
                catch (Exception ex)
                {
                    MessageBox.Show("数据转化失败!", "警告");
                    return(false);
                }
            }
            return(true);
        }
예제 #4
0
        private void init()
        {
            tabControl1.Visible = true;
            GeneralFuc.ClearTextBox(this);
            mstxtDate.Text = "00000000";

            //cmbType.SelectedItem = null;
            cmbName.SelectedItem = null;
            probe = new UltraProbe();
            dataGridView1.Rows.Clear();
            openPath          = "";
            savePath          = "";
            cache_Zr          = new List <double>();
            cache_Zi          = new List <double>();
            cache_interCouple = new List <double>();
            cacheNum          = -1;
        }
예제 #5
0
        private void cmbProductName_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (cmbProductName.SelectedItem != null && isclick)
            {
                if (MessageBox.Show("是否载入参数", "确认", MessageBoxButtons.OKCancel) == DialogResult.OK)
                {
                    string path = Application.StartupPath + "\\resources\\product\\" + cmbProductName.SelectedItem.ToString() + ".xml";

                    //clear TextBox
                    GeneralFuc.ClearTextBox(this);
                    maskedtxtDate.Text = "00000000";
                    defectGrid.Rows.Clear();
                    //deserialize
                    product = SystemConfig.DeserializeFromXml(path, product);
                    ClassToUI();
                    openPath = path;

                    isclick = false;
                    int a = cmbProductName.SelectedIndex;
                    if (a < 0)
                    {
                        a = 0;
                    }
                    else
                    {
                        cmbProductName.Items[a] = product.name;
                    }
                }
                else
                {
                    isclick = false;
                    int a = cmbProductName.SelectedIndex;
                    if (a < 0)
                    {
                        a = 0;
                    }
                    else
                    {
                        cmbProductName.Items[a] = product.name;
                    }
                }
            }
        }
예제 #6
0
        private void btnOpenXml_Click(object sender, EventArgs e)
        {
            OpenFileDialog openDialog = new OpenFileDialog();

            openDialog.Title            = "";
            openDialog.InitialDirectory = Application.StartupPath + "\\resources\\probe";
            openDialog.RestoreDirectory = false;
            if (openDialog.ShowDialog() == DialogResult.OK)
            {
                openPath = openDialog.FileName;

                //InitInterface();
                GeneralFuc.ClearTextBox(this);
                dataGridView1.Rows.Clear();
                mstxtDate.Text = "00000000";
                //deserialize
                probe = SystemConfig.DeserializeFromXml(openPath, probe);
                ClassToUI();
            }
        }
예제 #7
0
        public void FormLoad()
        {
            string filename = "probe";
            string filepath = "";

            filepath = SystemConfig.GlobalLoad(filename);

            if (filepath == "")
            {
                MessageBox.Show("探头信息配置失败", "警告");
                return;
            }

            //InitInterface();
            GeneralFuc.ClearTextBox(this);
            mstxtDate.Text = "00000000";

            //deserialize
            probe = SystemConfig.DeserializeFromXml(filepath, probe);
            ClassToUI();

            mainform.Getprobe(probe);
        }
예제 #8
0
 private void ClassToUI()
 {
     //InitInterface();
     GeneralFuc.ClearTextBox(this);
     mstxtDate.Text = "00000000";
     //Print to UI
     try
     {
         mstxtDate.Text         = wedge.date;
         cmbName.Text           = wedge.name;
         txtType.Text           = wedge.type;
         txtDrawNum.Text        = wedge.drawingPartNum;
         txtManufacturer.Text   = wedge.manu;
         txtSequenceNum.Text    = wedge.sn;
         txtLXL.Text            = wedge.length.ToString();
         txtLXW.Text            = wedge.width.ToString();
         txtLXH.Text            = wedge.height.ToString();
         txtLDW.Text            = wedge.headLen.ToString();
         txtAngle.Text          = wedge.incidentAngle.ToString();
         txtLongVeloc.Text      = wedge.longVeloc.ToString();
         txtTransVeloc.Text     = wedge.transVeloc.ToString();
         txtOperTempMin.Text    = wedge.operTempMin.ToString();
         txtStoreTemperMin.Text = wedge.storeTemprMin.ToString();
         txtOperTempMax.Text    = wedge.operTempMax.ToString();
         txtStoreTemperMax.Text = wedge.storeTemprMax.ToString();
         txtWedgePos.Text       = positions.wedgePosition.ToString();
         txtProbePos.Text       = positions.probePosition.ToString();
     }
     catch (Exception ex)
     {
         MessageBox.Show("数据导入失败!请检查文件是否正确!", "警告");
         init();
         return;
     }
     isexist             = true;
     tabControl1.Visible = true;
 }
예제 #9
0
        private bool EnsurePara()
        {
            if (isexist == false)
            {
                MessageBox.Show("数据错误!", "警告");
                return(false);
            }
            else if (cobGrooveKind.SelectedItem == null)
            {
                MessageBox.Show("未设置坡口参数");
                return(false);
            }
            else
            {
                //Empty boxes are set zero
                GeneralFuc.SetEmptyTextBox(this);
                //UI convert to class
                try
                {
                    //tab1
                    product.name = cmbProductName.Text;

                    product.length    = double.Parse(txtLength.Text);
                    product.outsize   = double.Parse(txtOutsize.Text);
                    product.thickness = double.Parse(txtThickness.Text);

                    product.weldingMaterial = txtMaterial.Text;


                    //groove
                    product.groove.ClearList();
                    product.groove.sn         = txtGrooveSn.Text;
                    product.groove.longVeloc  = double.Parse(txtLongitudinal.Text);
                    product.groove.transVeloc = double.Parse(txtTransverse.Text);

                    //
                    if (tabGrooveKindPrm.SelectedTab == PageVgroove)
                    {
                        product.groove.type     = GrooveType.V;
                        product.groove.distance = double.Parse(txtVGroove_d.Text);
                        product.groove.height.Add(double.Parse(txtVGroove_h0.Text));
                        product.groove.height.Add(double.Parse(txtVGroove_h1.Text));
                        product.groove.angle.Add(double.Parse(txtVGroove_a0.Text));
                    }
                    else if (tabGrooveKindPrm.SelectedTab == PageXgroove)
                    {
                        product.groove.type = GrooveType.X;
                        //product.groove.distance = double.Parse(txtXGroove_d.Text);
                        product.groove.height.Add(double.Parse(txtXGroove_h0.Text));
                        product.groove.height.Add(double.Parse(txtXGroove_h1.Text));
                        product.groove.angle.Add(double.Parse(txtXGroove_a0.Text));
                    }
                    else if (tabGrooveKindPrm.SelectedTab == PageCRCgroove)
                    {
                        product.groove.type = GrooveType.CRC;
                        //product.groove.distance = double.Parse(txtCRCGroove_d.Text);
                        product.groove.height.Add(double.Parse(txtCRCGroove_h0.Text));
                        product.groove.height.Add(double.Parse(txtCRCGroove_h1.Text));
                        product.groove.height.Add(double.Parse(txtCRCGroove_h2.Text));
                        product.groove.height.Add(double.Parse(txtCRCGroove_h3.Text));
                        product.groove.angle.Add(double.Parse(txtCRCGroove_a0.Text));
                        product.groove.angle.Add(double.Parse(txtCRCGroove_a1.Text));
                        product.groove.angle.Add(double.Parse(txtCRCGroove_a2.Text));
                    }
                    else
                    {
                        MessageBox.Show("坡口参数转化失败 ", "错误");
                    }

                    //tab3
                    product.sample.name     = txtSampleName.Text;
                    product.sample.factory  = txtFactory.Text;
                    product.sample.date     = maskedtxtDate.Text;
                    product.sample.drawing  = txtDrawing.Text;
                    product.sample.sn       = txtSampleSn.Text;
                    product.sample.material = txtSampleMat.Text;
                    product.sample.standard = txtSampleStad.Text;
                    product.sample.groType  = (GrooveType)cmbSampleGroType.SelectedIndex;

                    product.sample.defects = new List <Defect>();
                    int row = defectGrid.Rows.Count;
                    for (int i = 0; i < row; i++)
                    {
                        Defect def = new Defect();

                        def.name          = defectGrid.Rows[i].Cells["name"].Value.ToString();
                        def.subregionName = defectGrid.Rows[i].Cells["subregion"].Value.ToString();
                        def.type          = defectGrid.Rows[i].Cells["type"].Value.ToString();
                        double.TryParse(defectGrid.Rows[i].Cells["beginaxil"].Value.ToString(), out def.beginAxial);
                        double.TryParse(defectGrid.Rows[i].Cells["endaxial"].Value.ToString(), out def.endAxial);
                        double.TryParse(defectGrid.Rows[i].Cells["beginradio"].Value.ToString(), out def.beginRadio);
                        double.TryParse(defectGrid.Rows[i].Cells["endradio"].Value.ToString(), out def.endRadio);

                        product.sample.defects.Add(def);
                    }

                    //if (e != null)
                    //{
                    //    MessageBox.Show("data conversion success");
                    //}
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                    return(false);
                }
            }
            return(true);
        }
예제 #10
0
        private bool EnsurePrm()
        {
            if (isexist == false)
            {
                MessageBox.Show("数据错误!", "警告");
                return(false);
            }
            else
            {
                //Empty boxes are set zero
                GeneralFuc.SetEmptyTextBox(this);
                //UI convert to class
                try
                {
                    probe.name             = cmbName.Text;
                    probe.type             = combType.SelectedIndex;
                    probe.date             = mstxtDate.Text;
                    probe.sn               = txtSequenceNum.Text;
                    probe.manu             = txtManufacturer.Text;
                    probe.drawingPartNum   = txtDrawingPartNum.Text;
                    probe.color            = txtColor.Text;
                    probe.length           = double.Parse(txtLength.Text);
                    probe.height           = double.Parse(txtHight.Text);
                    probe.width            = double.Parse(txtWidth.Text);
                    probe.connModel        = txtConnModel.Text;
                    probe.cableType        = txtCableType.Text;
                    probe.cableLen         = double.Parse(txtCableLen.Text);
                    probe.cableOuterDia    = double.Parse(txtCableOuterDia.Text);
                    probe.centerFreq       = double.Parse(txtCenterFreq.Text);
                    probe.minBand          = double.Parse(txtMinBand.Text);
                    probe.maxPluseDuration = double.Parse(txtMaxPluDur.Text);
                    probe.eleEdge          = double.Parse(txtEleEdge.Text);
                    probe.eleNum           = uint.Parse(txtEleNum.Text);
                    probe.eleSpace         = double.Parse(txtEleSpace.Text);
                    probe.storeTemprMin    = double.Parse(txtStoreTemprMin.Text);
                    probe.operTempMin      = double.Parse(txtOperTempMin.Text);
                    probe.storeTemprMax    = double.Parse(txtStoreTemperMax.Text);
                    probe.operTempMax      = double.Parse(txtOperTempMax.Text);
                    probe.maxVolt          = double.Parse(txtMaxVolt.Text);
                    probe.maxPrf           = double.Parse(txtMaxPrf.Text);
                    probe.maxContinuePrf   = double.Parse(txtMaxContinuePrf.Text);
                    probe.maxInterCouple   = double.Parse(txtMaxInterCouple.Text);
                    probe.maxHomoSenDiff   = double.Parse(txtMaxHomSenDiff.Text);

                    probe.Zi          = cache_Zi;
                    probe.Zr          = cache_Zr;
                    probe.interCouple = cache_interCouple;

                    //if (e != null)
                    //{
                    //    MessageBox.Show("data conversion success");
                    //}
                }
                catch (Exception ex)
                {
                    MessageBox.Show("数据转化失败!", "警告");
                    return(false);
                }
            }
            return(true);
        }