在HyperlinkTheme.xml中添加一个复选框,如
<Checkbox Name="MyCheckBox" X="18" Y="191" Width="-11" Height="17" TabStop="yes" FontId="3" HideWhenDisabled="yes">Install Driver</Checkbox>
我如何在bootstrapper中使用它?我修改了Bundle.wxs文件,如
<MsiPackage SourceFile="..\..\..\..\install\MyMSI.msi" InstallCondition="MyCheckBox" ForcePerMachine="yes" Vital="yes" Visible="yes" />
但是这不能正常工作。它没有安装MyMSI.msi但复选框值是“已选中”。我错过了什么。请帮忙。 提前致谢。
答案 0 :(得分:1)
您的复选框位于HyperlinkTheme.xml
的“选项”页面中吗?
根据来自WiX开发人员Bob Arnson的this answer,除了添加到“选项”页面的复选框之外的所有复选框都被忽略。
HyperlinkTheme.xml :
<Page Name="Options">
<Text X="11" Y="80" Width="-11" Height="30" FontId="2" DisablePrefix="yes">#(loc.OptionsHeader)</Text>
<Text X="11" Y="121" Width="-11" Height="17" FontId="3" DisablePrefix="yes">#(loc.OptionsLocationLabel)</Text>
<Editbox Name="FolderEditbox" X="11" Y="143" Width="-91" Height="21" TabStop="yes" FontId="3" FileSystemAutoComplete="yes" />
<Button Name="BrowseButton" X="-11" Y="142" Width="75" Height="23" TabStop="yes" FontId="3">#(loc.OptionsBrowseButton)</Button>
<Button Name="OptionsOkButton" X="-91" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0">#(loc.OptionsOkButton)</Button>
<Button Name="OptionsCancelButton" X="-11" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0">#(loc.OptionsCancelButton)</Button>
<!-- Additional checkbox control -->
<Checkbox Name="MyCheckBox" X="-11" Y="-173" Width="260" Height="17" TabStop="yes" FontId="3">#(loc.MyCheckbox)</Checkbox>
</Page>
如果您确实将其添加到“选项”页面,则在bundle.wxs
文件中使用该条件的方式可能存在问题。尝试上面链接的问题中使用的方法,看看它是如何工作的:
<Variable Name="MyVariable" Type="numeric" Value="![CDATA[MyCheckBox]]"/>
答案 1 :(得分:0)
在您的public class VehicleController
{
private gearbox[] gearboxes;
private readonly Transform transform;
public VehicleController(Transform _transform)
{
gearboxes = new gearbox[0];
transform = _transform;
}
[System.Serializable]
public class gearbox
{
public Transform gearBoxTarget;
public List<Transform> assets = new List<Transform>();
public gearbox(Transform gearBoxTarget, List<Transform> assets)
{
this.gearBoxTarget = gearBoxTarget;
this.assets = assets;
}
}
void Awake()
{
/// count all gBox into 3d model
List<Transform> boxes = new List<Transform>();
Transform[] elems = transform.GetComponentsInChildren<Transform>();
int Index = 0;
for (int c = 0; c < elems.Length; c++)
{
if (elems[c].name == "gearbox")
{
Index++;
boxes.Add(elems[c].transform);
}
}
/// set array length (1 for gBox finded)
System.Array.Resize(ref gearboxes, Index);
/// for all gearboxes finded (or boxes.Length... It's equal)
for (int box = 0; box < gearboxes.Length; box++)
{
// get suspansions and wheels
Transform[] inBox = boxes[box].GetComponentsInChildren<Transform>();
List<Transform> Items = new List<Transform>();
for (int e = 0; e < inBox.Length; e++)
{
var el = inBox[e];
if (el.parent.name == "gearbox" || el.name == "wheel") { Debug.Log(e + " => " + el); Items.Add(el); } else { Debug.Log(e); }
if (e == inBox.Length) { Debug.Log("finder end"); }
}
/// add elements into the gearbox object
Debug.Log(gearboxes[box]);
gearboxes[box].gearBoxTarget = boxes[box];
gearboxes[box].assets.AddRange(Items);
}
}
}
元素中,声明<MsiPackage