Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
From 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 =$q
    ([xml]$wc.downloadstring($url)) | 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.