title: How to check if a button is clicked?
body: <p>I have a following LOC in my ps1 script which displays a message with an OK button.</p>
  
  <pre><code>[Windows.Forms.MessageBox]::Show($Message, $Title, [Windows.Forms.MessageBoxButtons]::OK, [System.Windows.Forms.MessageBoxIcon]::Information, [System.Windows.Forms.MessageBoxDefaultButton]::Button1, [System.Windows.Forms.MessageBoxOptions]::DefaultDesktopOnly) | Out-Null   
  </code></pre>
  
  <p>I want to perform some operation only if the user clicks the OK button something like:</p>
  
  <pre><code>if (Button1.pressed())
  {
     #perform some operations
  }
  </code></pre>
  
  <p>How do I check if the button is clicked?</p>
  
  <p>Thanks</p>