InitializeTabWindow Function for Data Standard
The InitializeTabWindow
function is executed whenever the context of a custom tab in Vault changes. The function is used to adjust the content of a custom tab for the different XAML files.
Usage
Called from the Vault-AddIn. The function is mandatory and cannot be removed.
A default implementation is available in:
- C:\ProgramData\Autodesk\
\Extensions\DataStandard\Vault\addinVault\Default.ps1
Example
function OnTabContextChanged
{
$xamlFile = [System.IO.Path]::GetFileName($vaultcontext.usercontrol.xamlfile)
if ($vaultcontext.selectedobject.typeid.selectioncontext--eq-"filemaster"--and-$xamlfile--eq-"cad-bom.xaml")
{
$filemasterid = $vaultContext.SelectedObject.Id
$file = $vault.DocumentService.GetLatestFileByMasterId($filemasterid)
$bom = @(getfilebom($file.id))
$dsWindow.FindName("bomlist").ItemsSource = $bom
}
if ($vaultcontext.selectedobject.typeid.selectioncontext--eq-"itemmaster"--and-$xamlfile--eq-"associated-files.xaml")
{
$items = $vault.ItemService.GetItemsByIds(@($vaultContext.SelectedObject.Id))
$item = $items[0]
$itemids = @($item.id)
$assocFiles = @(GetAssociatedFiles $itemids $([System.IO.Path]::GetDirectoryName($vaultcontext.usercontrol.xamlfile)))
$dsWindow.FindName("assoicatedfiles").ItemsSource = $assocFiles
}
}