如何向操作中心发送通知?
How to send notifications to the Action Center?
我只找到了,好像和Action Center没有关系
我想有一种使用 PowerShell 发送通知的简单方法,但我似乎找不到它。
出现在操作中心的通知往往是 Toast 通知,表示用户在屏幕上时没有点击离开。
例如我插入一张空白 DVD,祝酒,问我想用它做什么,但没有点击它,它随后显示在操作中心的通知列表中。
我不确定绕过吐司步骤的方法。
所以您可能想要的是吐司(也许是无声的?),它会在操作中心结束。
我写了一个 powershell 模块来显示这些 Toast,BurntToast (or check out the GitHub repo 用于说明和示例等)
您可以按原样随意使用该模块,或将其拆开以了解其工作原理并进行您自己的实现。有很多示例和 documentation 如何在 C# and/or 现代应用程序中执行此操作,现在您知道要搜索的关键字。
为你的工作干杯怎么样?
Get-EventSubscriber -SourceIdentifier JobEnd -EA 0| Unregister-Event
$action = {
if ($sender.State -eq 'Completed') {
Write-Host $sender.Name -fore green
Import-Module d:\scripts\BurntToast
$global:jobInfo = Receive-Job $job
New-BurntToastNotification -Text 'Job Completed'. "Job: $($sender.Name) was successful"
}
}
$job = Start-Job { Start-Sleep -Seconds 5; 1 .. 5 }
Register-ObjectEvent $job -EventName StateChanged -SourceIdentifier JobEnd -Action $action
$job.State
我只找到了
我想有一种使用 PowerShell 发送通知的简单方法,但我似乎找不到它。
出现在操作中心的通知往往是 Toast 通知,表示用户在屏幕上时没有点击离开。
例如我插入一张空白 DVD,祝酒,问我想用它做什么,但没有点击它,它随后显示在操作中心的通知列表中。
我不确定绕过吐司步骤的方法。
所以您可能想要的是吐司(也许是无声的?),它会在操作中心结束。
我写了一个 powershell 模块来显示这些 Toast,BurntToast (or check out the GitHub repo 用于说明和示例等)
您可以按原样随意使用该模块,或将其拆开以了解其工作原理并进行您自己的实现。有很多示例和 documentation 如何在 C# and/or 现代应用程序中执行此操作,现在您知道要搜索的关键字。
为你的工作干杯怎么样?
Get-EventSubscriber -SourceIdentifier JobEnd -EA 0| Unregister-Event
$action = {
if ($sender.State -eq 'Completed') {
Write-Host $sender.Name -fore green
Import-Module d:\scripts\BurntToast
$global:jobInfo = Receive-Job $job
New-BurntToastNotification -Text 'Job Completed'. "Job: $($sender.Name) was successful"
}
}
$job = Start-Job { Start-Sleep -Seconds 5; 1 .. 5 }
Register-ObjectEvent $job -EventName StateChanged -SourceIdentifier JobEnd -Action $action
$job.State