Disabled button still triggers Click event
问题 I'm tring to prevent users to rapidly spam-click a button, which would freeze the app possibly for minutes while the code is being executed many times. $searchBtn_clicked = { $searchBtn.Enabled = $false ... some code that fills a listview from search result $searchBtn.Enabled = $true } My problem is: the code above will be executed as many times as the button is clicked, no matter what. Disabling the button after a click changes nothing. I also tried adding a start-sleep 2 before Enabling it