如何解决如何使用 Powershell 中的可操作按钮进行 Toast 通知
我正在尝试创建一个 Toast 通知,其中将包含一个按钮,单击该按钮时将打开一个文本文件。该按钮将被命名为“打开新文件”,单击时,我希望它创建一个新文件。我该怎么做呢?我假设它是具有激活类型的东西,但我不知道如何将它合并到我的代码中。我是否创建了一个函数来打开文件并以激活类型调用该函数?
[xml]$Toast = @"
<toast scenario="$Scenario">
<visual>
<binding template="ToastGeneric">
<text>$ToastTitle</text>
</binding>
</visual>
<actions>
<action activationType="system" arguments="dismiss" content="Dismiss"/>
<action arguments="newTextFile" content="Create new file"/>
</actions>
</toast>
"@
$ToastXml = New-Object Windows.Data.Xml.Dom.XmlDocument
$ToastXml.LoadXml($ToastTemplate.OuterXml
$AppID = '{1AC14E77-02E7-4E5D-B744-2EB1AE5198B7}\WindowsPowerShell\v1.0\powershell.exe'
$Notification = [Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier($AppID)
$Notification.Show($ToastXml)
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。