PoshCode Archive  Artifact Content

Artifact b2c8a5fb8d1e396414bdf4b8993f7e501a10d1996f9604380f50bfeb1fbbb085:

  • File Wacth-TechED-Sessions.ps1 — part of check-in [06a50eb3ff] at 2018-06-10 13:14:26 on branch trunk — WPF GUI to watch TechED 2011, NA sessions (user: Ravikanth size: 1871)

# encoding: ascii
# api: powershell
# title: Wacth TechED Sessions
# description: WPF GUI to watch TechED 2011, NA sessions
# version: 0.1
# type: function
# author: Ravikanth
# license: CC0
# function: Get-TechEDSession
# x-poshcode-id: 2690
# x-archived: 2011-05-27T22:43:54
# x-published: 2011-05-23T09:37:00
#
#
ipmo WPK
Function Get-TechEDSession {                

    $url = "https://channel9.msdn.com/Events/TechEd/NorthAmerica/2011/RSS/"
    $wc   = New-Object net.webclient
    #$wc.Proxy.Credentials = Get-Credential
    $feed = ([xml]($wc.downloadstring($url))).rss.channel.item            

    $feed | ForEach {
                New-Object PSObject -Property @{
                Title = $_.title
                Url = $_.Enclosure.url
                Category = @($_.Category)
            }
    }
}                        

$sessions = Get-TechEDSession
New-Window -Title "TechED - NA 2011 Session viewer" -WindowStartupLocation CenterScreen -Width 1200 -Height 600 -On_Loaded {
    $lstBox = $window | Get-ChildControl lstBox
    $lstBox.ItemsSource = $sessions
} {
    New-Grid -Rows 32, 1* -Columns 300, 900* {                        

        New-ComboBox -Name cmbBox -MaxHeight 400 -MaxWidth 300 -ItemsSource @($sessions | Select -ExpandProperty Category -Unique) -On_SelectionChanged {
            $lstBox = $window | Get-ChildControl lstBox
            $lstBox.ItemsSource = @($sessions | ? { $_.Category -Contains $this.SelectedValue})
        }                        

        New-ListBox -Name lstBox -Row 1 -Column 0 -DisplayMemberPath Title -On_SelectionChanged {
                $wplayer = $window | Get-ChildControl player
                $wplayer.Source = $this.SelectedItem.Url
            }                        

        New-MediaElement -Name player -Column 1 -RowSpan 2
    }
} -Show