bool ProgramHDX(string sNewUID) { bool bSuccess = false; string sHexadecimalNewUID = Utility.ConvertUID_FormDecimalToHexadecimal(sNewUID).ToString("X16"); bool bProgramSuccess = tagProgrammer.WriteHDX(sHexadecimalNewUID, bLock); if (bLock) { if (bProgramSuccess) { bSuccess = tagProgrammer.ReadHDX() == sHexadecimalNewUID; } } else { bSuccess = bProgramSuccess; } if (bSuccess) { labelMessage.ForeColor = Color.Black; labelMessage.Text = "Program new UID is successful."; } else { labelMessage.ForeColor = Color.Red; labelMessage.Text = "Program new UID fail."; } return(bSuccess); }
void bgwTagProgrammer_DoWork(object sender, DoWorkEventArgs e) { bProgrammSuccess = false; switch (prodParam.iTagType) { case Registration.TAG_TYPE_FDX: bProgrammSuccess = tagProgrammer.WriteFDX(FDX_UID, chkLock.Checked); if (!bProgrammSuccess) { bProgrammSuccess = tagProgrammer.WriteFDX(FDX_UID, chkLock.Checked); } if (!bProgrammSuccess) { bProgrammSuccess = tagProgrammer.WriteFDX(FDX_UID, chkLock.Checked); } ctrlSys.TagProgrammerResult = tagProgrammer.TagProgrammerResult; break; case Registration.TAG_TYPE_HDX: sUID_HEX = Utility.ConvertUID_FormDecimalToHexadecimal(labelUID.Text).ToString("X16"); bProgrammSuccess = tagProgrammer.WriteHDX(sUID_HEX, chkLock.Checked); if (chkLock.Checked) { if (bProgrammSuccess) { bProgrammSuccess = tagProgrammer.ReadHDX() == sUID_HEX; } } ctrlSys.TagProgrammerResult = tagProgrammer.TagProgrammerResult; break; case Registration.TAG_TYPE_HDX_PLUSE: sUID_HEX = Utility.ConvertUID_FormDecimalToHexadecimal(labelUID.Text).ToString("X16"); bProgrammSuccess = tagProgrammer.WriteHDX_Plus(sUID_HEX, chkLock.Checked, prodParam.iTrimmingFrequency); if (!bProgrammSuccess) { bProgrammSuccess = tagProgrammer.WriteHDX_Plus(sUID_HEX, chkLock.Checked, prodParam.iTrimmingFrequency); if (!bProgrammSuccess) { bProgrammSuccess = tagProgrammer.WriteHDX_Plus(sUID_HEX, chkLock.Checked, prodParam.iTrimmingFrequency); } } //if (chkLock.Checked) //{ // if (bProgrammSuccess) // { // bProgrammSuccess = tagProgrammer.ReadHDX_Plus() == sUID_HEX; // } //} ctrlSys.TagProgrammerResult = tagProgrammer.TagProgrammerResult; break; } e.Cancel = bgwTagProgrammer.CancellationPending; }