3

我正在使用 Wix 3.7。我正在尝试创建安装我的 msi 的 wix burn 引导程序。我在我的 BA UI 中添加了两个按钮用于安装和取消。我正在使用 C# 进行 BA UI 设计。

我在安装按钮中添加了以下代码以进行启动安装。

  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;

并使用启动安装

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

安装工作正常。但是我在中途取消安装时遇到问题。

我看到了引导程序应用程序回滚链接。但我无法了解 IDCANCEL 以及如何通过单击按钮触发错误事件。

谁能通过单击 BA UI 中详细的取消按钮来告诉如何停止安装?

4

1 回答 1

8

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).

于 2013-03-10T17:13:00.720 回答