cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
pbcole
Level 2

Update progress bar during uninstall

Hi,

My team is running a rather long custom uninstall action and would like the progress bar to update as the action executes. We're handling the progress bar the same way we handled it during the install, spawning a process which updates the bar via the ProgressAccess interface that UninstallerProxy implements.

However, when the custom action executes, the status text disappears and the progress stays stuck until the action completes.

We're also trying to update the status text several times for the same custom code action.

The runnable that updates the progress bar resembles the following:
public ProgressUpdater(ProgressAccess progressAccess, long estimatedTime) {
this.progressAccess = progressAccess;
this.estimatedTime = estimatedTime;
}

public void run() {
int percentage = 0;

long sleepTime = Math.round(estimatedTime * BUFFER);

while (!actionCompleted && percentage < MAX_IN_PROGRESS_PERCENTAGE) {
progressAccess.setProgressPercentage(percentage++);
try {
Thread.sleep(sleepTime);
} catch (InterruptedException e) {
// No operation needed, just stop the thread
}
}
}

public void setActionCompleted() {
actionCompleted = true;
}

public void updateStatusText(String message) {
progressAccess.setProgressStatusText(message);
}


And then we use the runnable like this:
// Fork a new thread to update progress bar
ProgressUpdater progressBar = new ProgressUpdater(proxy, estimatedUninstallTime);
new Thread(progressBar).start();

try {
progressBar.updateStatusText("Running part A...");
// ... run part A

progressBar.updateStatusText("Running part B...");
// ... run part B
} finally {
progressBar.setActionCompleted();
}


Any help/tips would be much appreciated.

We are using IA 2010 Enterprise SP1 (IBM HotFix F).

Regards,
Bennett
Labels (1)
0 Kudos
(7) Replies
Tim_Mayert
Level 9

pbcole, did you ever get this solved?

We have a Basic MSI project that has a custom action that gets triggered and runs for about 5 minutes, but the progress bar remains at 94% and hangs there until the custom action is done. So we would like to see if we can reset the progress bar and have it slowly increment until the custom action is complete.

So is there a go way to handle this or get it to work?

Thanks,
0 Kudos
pbcole
Level 2

Hi Tim,

I've had no luck so far. I upgraded to IA 2011 yesterday to see if it solved our issue, but it's had no impact so far.

Still unable to get any status text to render either.

I am, however, using Java. For your MSI you're using .Net, no?

Regards,
Bennett
0 Kudos
Tim_Mayert
Level 9

Thanks for the info..

The custom actions are simple C++ msi dlls. So I have been looking around and in the help under "Adding Custom Actions to the ProgressBar" there is a big discription on how to add ticks/text to the progress bar, but just have to read and reread it to understand it. There is a small sample there, but it is only half of what is required. So I'll just have to read more into it.

Thanks,
0 Kudos
rox163
Level 5

I have the same requirement using IA2010 SP1...Where can I find documentation about using the ProgressUpdater class?
Thanks
0 Kudos
rox163
Level 5

pbcole wrote:
Hi,

And then we use the runnable like this:
// Fork a new thread to update progress bar
ProgressUpdater progressBar = new ProgressUpdater(proxy, estimatedUninstallTime);
new Thread(progressBar).start();

try {
progressBar.updateStatusText("Running part A...");
// ... run part A

progressBar.updateStatusText("Running part B...");
// ... run part B
} finally {
progressBar.setActionCompleted();
}




Is the part above, in the
public void uninstall(UninstallerProxy up) throws InstallException 

method of your CustomCode class?
0 Kudos
kolbywhite28
Level 3

Can you please elaborate more about making customized progress bars? I'm a little bit confuse about this one.
0 Kudos
aryan143143
Level 3

I have no success with above code with InstallAnywhere 2010.
Any updates with this ?
0 Kudos