I thought this would be an easy one, but Im scratching my head.... Just need to allow the user 3 button presses before it becomes greyed out. Here is my code:
$PostponeButton_OnClick= { [System.Windows.Forms.MessageBox]::Show("Number of clicks $NumberOfClicks", "Confirmation" , 0) #TODO: Place custom script here $NumberOfClicks = $NumberOfClicks++ [System.Windows.Forms.MessageBox]::Show("Number of clicks $NumberOfClicks", "Confirmation" , 0) $TimeLeftMin = $TimeLeftMin + 20 $progressBar1.Maximum = ($progressBar1.Maximum + 1200) If($NumberOfClicks -ge 2){ $PostponeButton.Enabled = $False } }
But the value of $NumberOfClicks remains at 0, despite clicking several times....