Last active
January 5, 2024 08:24
-
-
Save Tiberriver256/589be08ff7db0560db8a3b9cbc02fc07 to your computer and use it in GitHub Desktop.
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
function Show-HTML ([string]$HTML) | |
{ | |
[void][System.Reflection.Assembly]::LoadWithPartialName('presentationframework') | |
[xml]$XAML = @' | |
<Window | |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |
Title="PowerShell HTML GUI" WindowStartupLocation="CenterScreen"> | |
<WebBrowser Name="WebBrowser"></WebBrowser> | |
</Window> | |
'@ | |
#Read XAML | |
$reader=(New-Object System.Xml.XmlNodeReader $xaml) | |
$Form=[Windows.Markup.XamlReader]::Load( $reader ) | |
#=========================================================================== | |
# Store Form Objects In PowerShell | |
#=========================================================================== | |
$WebBrowser = $Form.FindName("WebBrowser") | |
$WebBrowser.NavigateToString($HTML) | |
$Form.ShowDialog() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment