我更新TC soa編程。但是你想要做的是使用StructureManagementService.CreateBomWindows。
/// <summary>
/// Opens a structure Management BOM Window
/// </summary>
/// <typeparam name="T">BOM window</typeparam>
/// <param name="action">action to do in the BOM window</param>
/// <param name="bomWindowOwner">root node for the BOM window</param>
/// <returns></returns>
public static T OpenBomWindow<T>(Func<CreateBOMWindowsResponse, T> action, ModelObject bomWindowOwner)
{
CreateBOMWindowsResponse windowResponse = TCProgram.StructureManageServiceCad.CreateBOMWindows(new CreateBOMWindowsInfo[]
{
new CreateBOMWindowsInfo()
{
ItemRev = bomWindowOwner as Mstrong.ItemRevision,
Item = bomWindowOwner as Mstrong.Item
}
});
try
{
return action.Invoke(windowResponse);
}
finally
{
TCProgram.StructureManageServiceCad.CloseBOMWindows(windowResponse.Output.Select(x => x.BomWindow).ToArray());
}
}
一旦你有了這個方法,你的聲明就會像這樣。
OpenBomWindow(
(CreateBOMWindowsResponse bomResponse) =>
{
Mstrong.BOMLine bomLine = bomResponse.Output[0].BomLine;
},
parentItemRev);
希望有幫助。
爲什麼給你我 - ???我需要幫助! –