2022-02-14 16:28:22 +00:00
|
|
|
|
#Send Notif Script
|
|
|
|
|
|
|
|
|
|
#get xml notif config
|
2022-03-14 15:04:02 +00:00
|
|
|
|
[xml]$NotifConf = Get-Content "$env:ProgramData\Winget-AutoUpdate\config\notif.xml" -Encoding UTF8 -ErrorAction SilentlyContinue
|
2022-02-14 16:28:22 +00:00
|
|
|
|
if (!($NotifConf)) {break}
|
|
|
|
|
|
|
|
|
|
#Load Assemblies
|
|
|
|
|
[Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] | Out-Null
|
|
|
|
|
[Windows.Data.Xml.Dom.XmlDocument, Windows.Data.Xml.Dom.XmlDocument, ContentType = WindowsRuntime] | Out-Null
|
|
|
|
|
|
|
|
|
|
#Prepare XML
|
|
|
|
|
$ToastXml = [Windows.Data.Xml.Dom.XmlDocument]::New()
|
|
|
|
|
$ToastXml.LoadXml($NotifConf.OuterXml)
|
|
|
|
|
|
|
|
|
|
#Specify Launcher App ID
|
|
|
|
|
$LauncherID = "Windows.SystemToast.Winget.Notification"
|
|
|
|
|
|
|
|
|
|
#Prepare and Create Toast
|
|
|
|
|
$ToastMessage = [Windows.UI.Notifications.ToastNotification]::New($ToastXML)
|
|
|
|
|
$ToastMessage.Tag = $NotifConf.toast.tag
|
2022-03-14 15:04:02 +00:00
|
|
|
|
[Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier($LauncherID).Show($ToastMessage)
|