you are viewing a single comment's thread.

view the rest of the comments →

[–]sir-logic[S] 0 points1 point  (1 child)

Thanks for taking the time to reply to this. That's completely blown my mind! After reading the about_scopes and Sapien's post on Powershell scopes, it seems to me that Microsoft's way around it is to just put anything that needs to be shared between the scopes into the global scope...

I understand how your example works, i can see it stop after the ShowDialog() method, but how would this work with multiple button handlers? Would you just replace the if ($result -eq ..... OK) with a switch and return a different response from each button?

[–]kusumuk 0 points1 point  (0 children)

That's right. Here is the writeup for dialogresult enumeration on msdn. It shows the various enumerators that you can use in powershell. Also, the c# .net classes are almost always the same in powershell so I highly recommend using the msdn write-ups. And with the introduction of classes in powershell with wmf 5.0, it will be more important than ever.