Last active
April 8, 2023 06:44
-
-
Save dfinke/e6e260416401b6ce9a66 to your computer and use it in GitHub Desktop.
PowerShell GUI for viewing YouTube Videos of the PowerShell NA Summit 2015
This file contains 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
Add-Type -AssemblyName PresentationFrameWork | |
$MainWindow=@' | |
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |
Topmost="True" | |
WindowStartupLocation="CenterScreen" | |
Title="PowerSHell Summit Videos" Height="850" Width="1200"> | |
<Grid> | |
<Grid.RowDefinitions> | |
<RowDefinition Height="200"/> | |
<RowDefinition/> | |
</Grid.RowDefinitions> | |
<ListBox x:Name="lstTitles" Grid.Row="0" Margin="3"/> | |
<WebBrowser x:Name="Viewer" Grid.Row="1" Margin="3"/> | |
</Grid> | |
</Window> | |
'@ | |
$Window = [Windows.Markup.XamlReader]::Load((New-Object System.Xml.XmlNodeReader ([xml]$MainWindow))) | |
$lstTitles=$Window.FindName("lstTitles") | |
$Viewer=$Window.FindName("Viewer") | |
$lstTitles.ItemsSource = Invoke-RestMethod https://gdata.youtube.com/feeds/users/UCqIw7UUwC5fUBFXYX68aMrQ/uploads | | |
ForEach { | |
$date=(Get-Date($_.published)) | |
if($date.year -eq 2015 -and $date.Month -eq 4) {$_} | |
} | | |
ForEach { | |
[PSCustomObject][ordered]@{ | |
title=$_.title.'#text' | |
href=$_.link.href[0] | |
} | |
} | |
$lstTitles.DisplayMemberPath="title" | |
[void]$lstTitles.Focus() | |
$lstTitles.add_SelectionChanged({$Viewer.Navigate($lstTitles.SelectedItem.href)}) | |
[void]$Window.ShowDialog() |
Yes you are right. What version of PowerShell are you running?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Great script, however I got an exception error when trying load XAML on line 21;
I believe I corrected this by turning STA mode on powershell
Powershell.exe -STA