OpenFileDialog causes Not Responding

This forum can be browsed by the general public. Posting is limited to current SAPIEN license holders with active maintenance and does not offer a response time guarantee.
Forum rules
DO NOT POST SUBSCRIPTION NUMBERS, LICENSE KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
User avatar
vmotto
Posts: 4
Joined: Wed Jun 06, 2012 9:40 am

OpenFileDialog causes Not Responding

Post by vmotto » Wed Jun 13, 2012 9:01 am

Hi, I'm using PowerShell Studio version 3.0.4. When I try using OpenFileDialog, it works perfectly when I run the script using "Run Project" through PowerShell Studio. However, when I Package the project as an EXE file and run it, I get (Not Responding) error.

Is there any known issues when using OpenFileDialog in a Packaged Project ??

Here is the code I am using:

$restoreToolStripMenuItem_Click={
If (-not $connected) {
Call-ConnectedError_pff
} else {
$openfiledialog1.InitialDirectory = "$homeCisco-SP-Exported-xml"
$openfiledialog1.ShowDialog()

$fileToRestore = $openfiledialog1.FileName

$spXML = New-Object XML
$spXML.Load($fileToRestore)

$spName = $spXML.configConfMo.inConfig.lsServer.name
$spLocation = $spXML.configConfMo.Dn

$SP = Get-UcsServiceProfile -name $spName
if ($SP) {
Call-SpExistsError_pff
} else {
Call-Restore_pff
}
}
}


As soon as I click on the "Restore" menu item, the application shows (Not Responding) ... but doing the same using "Run Project" works fine.

Thanks

User avatar
davidc
Posts: 5913
Joined: Thu Aug 18, 2011 4:56 am

OpenFileDialog causes Not Responding

Post by davidc » Wed Jun 13, 2012 9:23 am

Try checking the Run in STA Mode option for the packager. David
David
SAPIEN Technologies, Inc.

User avatar
vmotto
Posts: 4
Joined: Wed Jun 06, 2012 9:40 am

OpenFileDialog causes Not Responding

Post by vmotto » Wed Jun 13, 2012 10:29 am

Yep, that worked ... Thanks.