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 LICENSE NUMBERS, ACTIVATION 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.
This topic is 11 years and 10 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
User avatar
vmotto
Posts: 4
Last visit: Sat Nov 08, 2014 4:59 pm

OpenFileDialog causes Not Responding

Post by vmotto »

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
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

OpenFileDialog causes Not Responding

Post by davidc »

Try checking the Run in STA Mode option for the packager. David
David
SAPIEN Technologies, Inc.
User avatar
vmotto
Posts: 4
Last visit: Sat Nov 08, 2014 4:59 pm

OpenFileDialog causes Not Responding

Post by vmotto »

Yep, that worked ... Thanks.
This topic is 11 years and 10 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.