المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : ignore button events on window mobile



C# Programming
11-06-2009, 07:21 PM
When I press a button (soft key on touch screen, or key on mobile device) I want to disable all other events from other buttons for a certain time. For example when I press Button1, I want Button1, events to be ignored for a few seconds, and then be active again. I have tried Button1.Enabled = false; if I press Button1 while it is disabled, when I re-enable it, the events still occur.

private void Button1_Click(object sender, EventArgs e)
{
Button1.Enabled = false;
textBox1.Text = "Button1 Pressed";
Thread.Sleep(Time);
Button1.Enabled = true;
}

How can I keep these events from occurring while the button is disabled?