Created
August 5, 2018 16:57
-
-
Save adamdriscoll/7a805a66d3888234e51318f700ee769a to your computer and use it in GitHub Desktop.
Tree View
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$Root = New-UDTreeNode -Name 'FileSystem' -Id 'FileSystem' | |
New-UDTreeView -Node $Root -OnNodeClicked { | |
param($Body) | |
$Obj = $Body | ConvertFrom-Json | |
if ($Obj.NodeId -eq 'FileSystem') { | |
Get-PSDrive -PSProvider FileSystem | ForEach-Object { | |
New-UDTreeNode -Name $_.Root -Id $_.Root | |
} | |
} else { | |
Get-ChildItem -Path $Obj.NodeId | ForEach-Object { | |
New-UDTreeNode -Name $_.Name -Id $_.FullName | |
} | ConvertTo-JsonEx | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment