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\<Vault version>\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 } }