Exemplo n.º 1
0
        private void tbUnitSN_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == (char)Keys.Enter)
            {
                SetMLBSNContext(tbUnitSN.Text);
//if only one UUT enable
                int count = 0;
                for (int i = 0; i < 6; i++)
                {
                    string key     = string.Format("{0}{1}", tmMarcos.kUUTEnable, i);
                    bool   bEnable = Convert.ToBoolean(TestContext.m_dicConfig[key]);
                    if (!bEnable)
                    {
                        continue;
                    }
                    count++;
                }
                if (count == 1)
                {
                    for (int i = 0; i < 6; i++)
                    {
                        string key     = string.Format("{0}{1}", tmMarcos.kUUTEnable, i);
                        bool   bEnable = Convert.ToBoolean(TestContext.m_dicConfig[key]);
                        if (!bEnable)
                        {
                            continue;
                        }
                        string      sn      = tbUnitSN.Text;
                        TestContext context = GT_UserInterface.GetTestContext(i);
                        context.m_dicContext[tmMarcos.kContextMLBSN] = sn;
                        (this.MdiParent as MainForm).m_frmState.SetSN(sn, i);
                    }
                    return;
                }
//
                frmSN frm = new frmSN(tbUnitSN.Text);
                if (frm.ShowDialog(this) == DialogResult.OK)
                {
                    for (int i = 0; i < 6; i++)
                    {
                        string key     = string.Format("{0}{1}", tmMarcos.kUUTEnable, i);
                        bool   bEnable = Convert.ToBoolean(TestContext.m_dicConfig[key]);
                        if (!bEnable)
                        {
                            continue;
                        }
                        string      sn      = frm.GetSN(i);
                        TestContext context = GT_UserInterface.GetTestContext(i);
                        context.m_dicContext[tmMarcos.kContextMLBSN] = sn;
                        (this.MdiParent as MainForm).m_frmState.SetSN(sn, i);
                    }
                }

                TestContext.m_dicConfig[tmMarcos.kConfigScanBarcode] = 1;//直接设置成false
                checkBoxNeedCode.Checked = true;
            }
        }
Exemplo n.º 2
0
        private void ShowBarCodeScan()
        {
            frmSN barcode = new frmSN(null);

            barcode.ShowDialog();
        }