我正在使用Wix 3.7。我正在尝试创建安装我的msi的wix burn bootstrapper。我在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);
安装工作正常。但我在中途取消安装时遇到问题。
我看到 bootstrapper application rollback 链接。但我无法了解IDCANCEL和如何通过按钮点击触发错误事件。
有人可以通过单击BA UI中的取消按钮详细说明如何停止安装吗?
答案 0 :(得分:8)
许多回调(如Progress
)将为您的bootstrapper应用程序提供args(如ProgressEventArgs
)。在args对象中,您可能会看到Result
属性。要取消,请将Result
属性设置为Result.Cancel
。当回调返回到Burn
引擎时,它会看到您将结果设置为取消并启动回滚过程(或在该上下文中执行取消操作)。