Last active
December 21, 2015 06:59
-
-
Save cnromaine/6268337 to your computer and use it in GitHub Desktop.
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…
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
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