Программа работает правильно. Когда появится приглашение и произойдет «Неверная RFID», появится сообщение «Неверное RFID», и я снова смогу выполнить сканирование. Однако, если RFID принимается, я хочу, чтобы приглашение закрыло AUTOMATICALLY. В этой программе приглашение не закрывается АВТОМАТИЧЕСКИ. Что я должен добавить, чтобы закрыть окно AUTOMATICALLY?Как закрыть окно подсказки?
private void serialPort1_DataReceived(object sender, SerialDataReceivedEventArgs e)
{
string ramses = serialPort1.ReadLine();
SetRFIDText(ramses);
}
private string dotRFID = "";
private bool shouldClose = false;
protected void SetRFIDText(string input)
{
this.Invoke(new Function(delegate()
{
string Hexed = new LasalleRFIDComputerRentals.BLL.DAL.Utils().HexIt(input);
dotRFID = Hexed.Trim();
txtRFID.Text = Hexed.Trim();
if (txtRFID.Text.Trim() == "")
{
MessageBox.Show(this, "Please provide the member's RFID.", "Save Member Information", MessageBoxButtons.OK);
txtRFID.Focus();
return;
}
CustomerInfo customer = new Customer().GetCustomerByRFID(txtRFID.Text);
if (customer.CustomerID <= 0)
{
MessageBox.Show(this, "Incorrect RFID.", "Validation", MessageBoxButtons.OK);
return;
}
else
{
txtRFID.Text = "";
if (_parentForm == "StandBy")
{
Utils.CurrentCustomer.CustomerInfo = customer;
frmStandBy form = (frmStandBy)this.Owner;
form.xResult = "OK";
this.Close();
}
}
}));
}
Я попытался с помощью этого this.Close();
в нижней части (под form.xResult = "OK";
), но в конечном итоге висит. Помогите!
Вы попросили [тот же вопрос] (http://stackoverflow.com/questions/15152754/how-to-close-the-prompt -window) несколько минут назад, и вы удалите его. Почему вы спрашиваете еще раз? Вам нужно улучшить старое, чтобы получить лучшие ответы. Пожалуйста, прочитайте [FAQ] и [ask] –
Извините. Я просто объяснил это здесь. – Kael