Created
February 7, 2019 23:15
-
-
Save Windos/7c750e9252bef7b654fb8464b0bcc708 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
Import-Module BurntToast | |
$Text1 = New-BTText -Content 'This is a test' | |
$Text2 = New-BTText -Content 'This more testing' | |
$AppLogo = New-BTImage -Source 'https://raw.githubusercontent.com/Windos/BurntToast/master/Media/BurntToast.png' -Crop Circle -AppLogoOverride | |
$Binding1 = New-BTBinding -Children $Text1, $Text2 -AppLogoOverride $AppLogo | |
$Visual1 = New-BTVisual -BindingGeneric $Binding1 | |
$Content = New-BTContent -Visual $Visual1 | |
$AppId = "{1AC14E77-02E7-4E5D-B744-2EB1AE5198B7}\WindowsPowerShell\v1.0\powershell.exe" | |
$null = [Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] | |
$null = [Windows.Data.Xml.Dom.XmlDocument, Windows.Data.Xml.Dom.XmlDocument, ContentType = WindowsRuntime] | |
$ToastXml = [Windows.Data.Xml.Dom.XmlDocument]::new() | |
$CleanContent = $Content.GetContent().Replace('<text>{', '<text>') | |
$CleanContent = $CleanContent.Replace('}</text>', '</text>') | |
$CleanContent = $CleanContent.Replace('="{', '="') | |
$CleanContent = $CleanContent.Replace('}" ', '" ') | |
$ToastXml.LoadXml($CleanContent) | |
$Toast = [Windows.UI.Notifications.ToastNotification]::new($ToastXml) | |
Register-ObjectEvent -InputObject $Toast -EventName 'Activated' -Action {Write-Warning 'WORKING!'} | |
[Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier($AppId).Show($Toast) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment