go-toast

Send toast notifications in Windows
Log | Files | Refs | README | LICENSE

powershell.go.tmpl (670B)


      1 [Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] | Out-Null
      2 [Windows.UI.Notifications.ToastNotification, Windows.UI.Notifications, ContentType = WindowsRuntime] | Out-Null
      3 [Windows.Data.Xml.Dom.XmlDocument, Windows.Data.Xml.Dom.XmlDocument, ContentType = WindowsRuntime] | Out-Null
      4 
      5 $APP_ID = '{{if .AppID}}{{.AppID}}{{else}}Windows App{{end}}'
      6 
      7 $template = @"
      8 {{.XML}}
      9 "@
     10 
     11 $xml = New-Object Windows.Data.Xml.Dom.XmlDocument
     12 $xml.LoadXml($template)
     13 $toast = New-Object Windows.UI.Notifications.ToastNotification $xml
     14 [Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier($APP_ID).Show($toast)