Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
From http://www.drdobbs.com/windows/building-gui-applications-in-powershell/240049898?pgno=2The Search-Twitter function returns an array of PowerShell objects with properties from the Twitter query. From that data, we extract the text of the tweet and the URL pointing to the Twitter user's profile image. If you look closely at the PowerShell cod…
Import-Module .\ShowUI
function Search-Twitter ($q) {
$wc = New-Object Net.Webclient
$url = http://search.twitter.com/search.rss?q=$q
    ([xml]$wc.downloadstring($url)).rss.channel.item | select *
}
 
$ws = @{
    WindowStartupLocation = "CenterScreen"
    Width = 500
    Height = 500
}
New-Window @ws -Show {
    ListBox -Background Black -ItemTemplate {
        Grid -Columns 55, 300 {
        Image -Column 0 -Name Image -Margin 5
        TextBlock -Column 1 -Name Title `
            -Margin 5 `
            -Foreground White `
            -TextWrapping Wrap
    } | ConvertTo-DataTemplate -Binding @{
            "Image.Source" = "image_link"
            "Title.Text" = "title"
    }
  } -ItemsSource (Search-Twitter PowerShell)
}
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.