Skip to content

Instantly share code, notes, and snippets.

@andreburto
Last active January 6, 2018 02:55
Show Gist options
  • Save andreburto/a07296f3d0be6b85516f5284a3f70ad1 to your computer and use it in GitHub Desktop.
Save andreburto/a07296f3d0be6b85516f5284a3f70ad1 to your computer and use it in GitHub Desktop.
function main{
Add-Type -AssemblyName presentationframework
$xaml = [xml]@"
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Name="Window"
Title="MainWindow"
Width="640" Height="480">
<Grid x:Name="LayoutRoot">
<Border>
<Image Source="$(imageUrl)" Stretch="Uniform"/>
</Border>
</Grid>
</Window>
"@
$reader = New-Object System.Xml.XmlNodeReader $xaml
$form = [Windows.Markup.XamlReader]::Load($reader)
$form.ShowDialog()
}
function imageUrl{
$img_list = ([xml]$(invoke-webrequest http://pics.mytrapster.com/yvonne-list.php).Content).images.image
return $img_list[(Get-Random -Minimum 0 -Maximum ($img_list.Length - 1))].full
}
. main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment