Skip to content

Instantly share code, notes, and snippets.

@dfinke dfinke/PSSummit.ps1
Last active Aug 29, 2015

Embed
What would you like to do?
PowerShell GUI for viewing YouTube Videos of the PowerShell NA Summit 2015
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()
@wizardmundo

This comment has been minimized.

Copy link

commented Apr 21, 2015

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

@dfinke

This comment has been minimized.

Copy link
Owner Author

commented Apr 21, 2015

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
You can’t perform that action at this time.