我们有一个wix设置(基于wix版本3.9),带有一个标准的wix包以及一个所谓的bundle,它显示了一个wpf gui(带有Bootstrapper等),我们可以在这里安装,更新和卸载 shabang 。一切应该是#34;书#34;据我所知......
现在问题:我们可以通过更改版本号进行升级,但我们似乎无法在此过程中禁用卸载GUI进行弹出。
我的想法已经不多了,这是别人必须解决的问题,但我找不到任何真正的解决方案。
由于它在C#中针对所谓的引擎进行管理,因此我们需要一些代码。
目前代码是这样的。 在我的BA类的Run方法中:
protected override void Run()
{
Dispatcher = Dispatcher.CurrentDispatcher;
var model = new BootstrapperApplicationModel(this);
Logging logging = new Logging(model);
var view = new MainView(model, logging, this.RunMode);
model.SetWindowHandle(view);
this.Engine.Detect();
view.Show();
Dispatcher.Run();
this.Engine.Quit(model.FinalResult);
}
然后在MainView类(或实际上后面的viewmodel)中执行此操作:
public void Activate(BootstrapperApplicationModel appModel, Logging modelLogging, LaunchAction runMode)
{
this.launchAction = runMode;
this.model = appModel;
this.logging = modelLogging;
this.WireUpEventHandlers();
this.OpenStartPageView();
}
private void WireUpEventHandlers()
{
this.model.BootstrapperApplication.PlanComplete += this.PlanComplete;
this.model.BootstrapperApplication.ApplyComplete += this.ApplyComplete;
this.model.BootstrapperApplication.ApplyBegin += this.ApplyBegin;
this.model.BootstrapperApplication.ExecutePackageBegin += this.ExecutePackageBegin;
this.model.BootstrapperApplication.ExecutePackageComplete += this.ExecutePackageComplete;
this.model.BootstrapperApplication.PlanMsiFeature += this.SetPlannedFeature;
this.model.BootstrapperApplication.DetectMsiFeature += SetFeatureDetectedState;
this.model.BootstrapperApplication.DetectRelatedBundle += this.DetectRelatedBundle;
this.model.BootstrapperApplication.DetectPackageComplete += this.DetectPackageComplete;
this.model.BootstrapperApplication.Engine.Detect();
}
希望可能会提供一些关于我们如何设置gui的想法。
在Activate函数中我觉得我需要类似下面的附加内容:
public void Activate(BootstrapperApplicationModel appModel, Logging modelLogging, LaunchAction runMode)
{
this.launchAction = runMode;
this.model = appModel;
this.logging = modelLogging;
if (this.launchAction == LaunchAction.Uninstall && /* something */)
{
this.model.PlanAction(this.launchAction); // Uninstall
return;
}
this.WireUpEventHandlers();
this.OpenStartPageView();
}
但我不知道如何传递来自不同版本的信息......
提前致谢!
答案 0 :(得分:2)
进行升级时,较新版本的安装将使用 / q参数调用以前版本的安装,这将为安装程序BA提供 Command.Display = Display。无或Display.Embedded
所以在上面的if-case示例中,它将如下所示:
public void Activate(BootstrapperApplicationModel appModel, Logging modelLogging,
LaunchAction runMode, Display display)
{
this.launchAction = runMode;
this.model = appModel;
this.logging = modelLogging;
this.displayMode = display;
if (this.launchAction == LaunchAction.Uninstall &&
(this.displayMode == Display.None || this.displayMode == Display.Embedded))
{
this.model.PlanAction(this.launchAction); // Uninstall
return;
}
this.WireUpEventHandlers();
this.OpenStartPageView();
}
解释我上面做了什么: