PDA

View Full Version : How could I terminate the installation?



321tseug
04-05-2006, 10:30 PM
1.preinstall
*1.1 a wizard dialog to gather some information that user inputed.

2.install
*2.1 custom product action to do installation
**...
**do some installation depend on what user had inputed
**...
**if (something wrong) {
***ProductAction.this.getServices().displayUserMessage("Error","Something Wrong!",WizardServicesUI.ERROR);
***back to 1.1 dialog //???
**}

I can't find any way or code to terminate the installation and back to wizard dialog.

could someone tell me how to solve the problem?
thanks for any help.

RobertDickau
04-06-2006, 09:08 AM
To exit the installation from a product action, you can throw an uncaught ProductException; please see, for example, Macrovision KB article Q106190 at http://support.installshield.com.

321tseug
04-06-2006, 10:15 PM
Thanks for your Tip.
I made the program like this:

1.preinstall
*1.1 a wizard dialog to gather some information that user inputed.

2.install
*2.1 custom product action to do installation



...
do some installation depend on what user had inputed
...
if (something wrong) {
ProductAction.this.getServices().displayUserMessage("Error","Something Wrong!",WizardServicesUI.ERROR);
// set a variable
try {
ISVariable oResult = getServices().getISDatabase().getVariable("product_action_error");
if ( oResult != null ) {
oResult.setValue(1);
}
}catch ( Exception e ) {
logEvent(this,Log.DBG,e);
}
....
throw new ProductExcpetion( ...);
}

3.postinstall
*3.1 a custom dialog will display depend on the condition ( $V( product_action_error) != 0 )
**and I added a entered listener to the dialog:


public void enteredXXXDialog(com.installshield.event.ui.ISDialogContext arg0)
{
final SwingWizardUI wizardUI = (SwingWizardUI)arg0.getWizardUI();
SwingUtilities.invokeLater( new Runnable() {
public void run() {
System.out.println("entered");
wizardUI.doPrevious();
}
});
}


and it runs well for me although the program flow is troublesome. :confused: :confused:
when some error occurs during the installation,
it shows a error dialog and it automatically turns back to the preinstall wizard dialog.