Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cancel Installation and Rollback using wix burn Bootstrapper UI

I am using Wix 3.7. I am trying to create wix burn bootstrapper that install my msi. I have added two buttons in my BA UI for Install and Cancel. i am using C# for BA UI design.

I have added the follwoing code in Install button for launch installation.

  MySampleBA.Model.Engine.Detect();
  MySampleBA.hwnd = IntPtr.Zero;          
  MySampleBA.Model.Bootstrapper.PlanBegin += this.PlanBegin;
  MySampleBA.Model.Bootstrapper.DetectPackageComplete += this.DetectedPackage;
  MySampleBA.Model.Bootstrapper.DetectComplete += this.DetectComplete;
  MySampleBA.Model.Bootstrapper.PlanPackageBegin += this.PlanPackageBegin;
  MySampleBA.Model.Bootstrapper.PlanComplete += this.PlanComplete;
  MySampleBA.Model.Bootstrapper.ExecuteMsiMessage += this.ExecuteMsiMessage;
  MySampleBA.Model.Bootstrapper.ExecuteProgress += this.ApplyExecuteProgress;
  MySampleBA.Model.Bootstrapper.PlanMsiFeature += this.PlanMsiFeature;
  MySampleBA.Model.Bootstrapper.PlanPackageComplete += this.PlanPackageComplete;
  MySampleBA.Model.Bootstrapper.Progress += this.ApplyProgress;
  MySampleBA.Model.Bootstrapper.CacheAcquireProgress += this.CacheAcquireProgress;
  MySampleBA.Model.Bootstrapper.CacheComplete += this.CacheComplete;
  MySampleBA.Model.Bootstrapper.Error += this.ExecuteError;
  MySampleBA.Model.Bootstrapper.ExecutePackageComplete += this.ExecuteComplte;

and launch install by using

  MySampleBA.Model.Engine.Plan(LaunchAction.Install);
  MySampleBA.Model.Engine.Apply(MySampleBA.hwnd);

The installation is working fine. But i have a problem with cancel the installation at mid.

I saw bootstrapper application rollback link. But i can't able to get an idea about IDCANCEL and How to trigger the Error event from button click.

Can anyone tell how to stop the installation by clicking cancel button which is in BA UI in detail?

like image 363
saravan1010 Avatar asked Oct 22 '25 05:10

saravan1010


1 Answers

Many of the callbacks (like Progress) will provide args (like ProgressEventArgs) to your bootstrapper application. In the args object you may see a Result property. To cancel, set the Result property to Result.Cancel. When the callback returns to the Burn engine, it will see you set the result to cancel and start the rollback process (or do whatever cancel means in that context).

like image 68
Rob Mensching Avatar answered Oct 23 '25 21:10

Rob Mensching