我正在使用此代码从PowerShell脚本发送通知.PowerShell本身是由(持久的)Java应用程序启动的.
[Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] > $null
[Windows.Data.Xml.Dom.XmlDocument, Windows.Data.Xml.Dom.XmlDocument, ContentType = WindowsRuntime] > $null
[Windows.UI.Notifications.ToastNotification, Windows.UI.Notifications, ContentType = WindowsRuntime] > $null
$xml = New-Object Windows.Data.Xml.Dom.XmlDocument
$template = "<toast><visual><binding template=`"ToastText02`"><text id=`"1`">Title</text><text id=`"2`">Test results</text></binding></visual></toast>"
$xml.LoadXml($template)
$toast = New-Object Windows.UI.Notifications.ToastNotification $xml
[Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier("sbt").Show($toast)
Run Code Online (Sandbox Code Playgroud)
它们会弹出屏幕,在操作中心可见,但很快就会消失.XAML应用程序使用相同代码发送的通知会在那里停留相当长的一段时间.有没有办法改变通过脚本发送的通知的行为?
归档时间: |
|
查看次数: |
2317 次 |
最近记录: |