Ejemplo n.º 1
0
        private void txtMAC_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Enter)
            {
                string _text = txtMAC.Text.Trim().Replace(":", "");
                //check thong tin bosa
                if (!BaseFunctions.mac_Address_Is_Correct(_text))
                {
                    tbMessage.Text = string.Format("Mac Address: \"{0}\" không hợp lệ.\nVui lòng nhập lại.", _text);
                    txtMAC.Clear();
                    txtMAC.Focus();
                    return;
                }
                //get thong tin bosa
                switch (this.dutNumber)
                {
                case "01": {
                    GlobalData.testingDataDut1.MACADDRESS = _text;
                    GlobalData.testingDataDut1.GPON       = BaseFunctions.GEN_SERIAL_ONT(_text);
                    break;
                }

                case "02": {
                    GlobalData.testingDataDut2.MACADDRESS = _text;
                    GlobalData.testingDataDut2.GPON       = BaseFunctions.GEN_SERIAL_ONT(_text);
                    break;
                }

                case "03": {
                    GlobalData.testingDataDut3.MACADDRESS = _text;
                    GlobalData.testingDataDut3.GPON       = BaseFunctions.GEN_SERIAL_ONT(_text);
                    break;
                }

                case "04": {
                    GlobalData.testingDataDut4.MACADDRESS = _text;
                    GlobalData.testingDataDut4.GPON       = BaseFunctions.GEN_SERIAL_ONT(_text);
                    break;
                }

                default: break;
                }

                //close form
                this.Close();
            }
        }