-
|
So far, I managed my own entry in And whenever I wanted to create a toast (mostly from Linux using WSL, don't ask why), I would launch New-BurntToastNotification `
-AppId Trallnag.Toast `
-Text "Genious", "fefefe", "fefef" `
-AppLogo C:\Users\Trallnag\Share\BurntToast\toast-icon.pngIs something like this still possible? I checked the source code / help messages. Is the following correct:
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Beta Was this translation helpful? Give feedback.
-
|
This is one area where I need to provide more documentation, because it sort of ties into the main pillar of v1.0.0 (actionable notifications). The module is now using "
The benefit to switching though, is now it's possible to register events against it, even in Windows PowerShell. This means now you can add a script block that fires when a user clicks the toast (or a button on the toast.) And then you can do things like read in the contents of a text box, or selection box (even on Windows PowerShell! Sorry I'm repeating myself, but this has been a goal for a very long time.) For completeness, this is an example of what this now allows: $Text1 = New-BTText -Content 'New Message'
$Text2 = New-BTText -Content 'This is a demo toast notification, let me know what you think.'
$Attrib = 'via Internal System X'
$Binding1 = New-BTBinding -Children $Text1, $Text2 -Attribution $Attrib
$Visual1 = New-BTVisual -BindingGeneric $Binding1
$TextInput = New-BTInput -PlaceholderContent 'Type reply here' -Id 'ConfirmBox'
$ButtonSplat = @{
Content = 'Reply'
Arguments = 'Reply'
ActivationType = 'Background'
}
$ConfirmButton = New-BTButton @ButtonSplat
$ConfirmButton.TextBoxId = 'ConfirmBox'
$Actions = New-BTAction -Inputs $TextInput -Buttons $ConfirmButton
$Content1 = New-BTContent -Visual $Visual1 -Actions $Actions
$GetReply = {
$ToastData = ($Event.SourceArgs | Where-Object {$_.GetType().Name -eq 'ToastNotificationActivatedEventArgsCompat'})[0]
if ($ToastData.UserInput.value -ne '' -and
$ToastData.Argument -eq 'Reply') {
$Output = 'User replied @ {0}: {1}' -f [datetime]::Now.ToString('s'),
$ToastData.UserInput.value
Write-Warning $Output
}
}
Submit-BTNotification -Content $Content1 -ActivatedAction $GetReply -EventDataVariable 'Testing'Because the compat Toast Manager automatically uses the AppID of the process that's calling it then, the shortcut was the most reliable way of having PowerShell run under a custom "identity". There's technically .NET code you can run, but it needs to execute during the processes start up and so by the time BurntToast is being executed it's too late to work reliably. All that said, if people don't care about the events, and they are currently using AppIds, then it's probably best (/easier) to pin to BurntToast v0.8.5. |
Beta Was this translation helpful? Give feedback.



Okay, it seems to work:
Still not sure what the advantage of automatically generating the app registrations is.