title: powershell multiple winform focus
body: <p>i have multiple forms in a powershell winforms gui application
  the main form has information that is always relevant to its user, though there are other forms that will display information sometimes relevant and so are not always visible.
  the main form will show in the taskbar but not the other sub forms.
  when i click on the main form in the taskbar, i am hoping to find a way to get the other forms to show up as well, currently they stay where they are behind other windows.</p>
  
  <p>the code below will assume other properties such as location and activation are set/triggered for each form $frmFUD is the main form with a button that activates frmSD form and is not shown in taskbar.</p>
  
  <pre><code>$appContext = New-Object System.Windows.Forms.ApplicationContext
  $frmFUD = New-Object System.Windows.Forms.Form
  $frmSD = New-Object system.Windows.Forms.Form
  </code></pre>
  
  <p>i am hoping that the above code will direct to a event handler i have not considered.
  trying something like </p>
  
  <pre><code>$frmFUD.Add_Activated({
      $frmSD.activate()
  })
  </code></pre>
  
  <p>brings the second form up but then i can't get the main form to keep focus.</p>
  
  <p>edit:
  i have tried:</p>
  
  <pre><code>$frmFUD.Add_activated({
      $frmSD.BringToFront()
  })
  </code></pre>
  
  <p>this locks the main window from ever getting focus again, i suspect i should be using some sort of if statement or different eventhandler.</p>